prima: WLAN Driver Release 3.2.0.9
diff --git a/CORE/MAC/src/cfg/cfgApi.c b/CORE/MAC/src/cfg/cfgApi.c
index a20d0ec..a857343 100644
--- a/CORE/MAC/src/cfg/cfgApi.c
+++ b/CORE/MAC/src/cfg/cfgApi.c
@@ -187,15 +187,6 @@
         PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);)
         retVal = eSIR_CFG_INVALID_ID;
     }
-#if 0
-    else if (((control & CFG_CTL_RESTART) && !Restarting(pMac)) ||
-             ((control & CFG_CTL_RELOAD) && !Reloading(pMac)))
-    {
-        cfgLog(pMac, LOGE, FL("Change requires a restart/reload cfg id %d state %d\n"),
-               cfgId, pMac->lim.gLimSmeState);
-        retVal = eSIR_CFG_INVALID_ID;
-    }
-#endif
     else if ((pMac->cfg.gCfgIBufMin[index] > value) ||
              (pMac->cfg.gCfgIBufMax[index] < value))
     {
@@ -957,20 +948,10 @@
     if(sessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
         return eSIR_SUCCESS;
 
-
-    
     // Short slot time bit
     if (systemRole == eLIM_AP_ROLE)
     {
-        if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &val)
-                       != eSIR_SUCCESS)
-        {
-            cfgLog(pMac, LOGP,
-                   FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
-            return eSIR_FAILURE;
-        }
-        if (val)
-            pCapInfo->shortSlotTime = 1;
+        pCapInfo->shortSlotTime = sessionEntry->shortSlotTimeSupported;
     }
     else
     {
@@ -989,16 +970,8 @@
          */
         if (val)
         {
-            if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &val)
-                           != eSIR_SUCCESS)
-            {
-                cfgLog(pMac, LOGP,
-                       FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
-                return eSIR_FAILURE;
-            }
-            if (val)
-            pCapInfo->shortSlotTime = 1;
-    }
+            pCapInfo->shortSlotTime = sessionEntry->shortSlotTimeSupported;
+        }
     }
 
     // Spectrum Management bit
@@ -1174,7 +1147,7 @@
     mmhMsg.bodyval = (tANI_U32)cfgId;
     mmhMsg.bodyptr = NULL;
 
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
 
     if ((ntfMask & CFG_CTL_NTF_SCH) != 0)
         schPostMessage(pMac, &mmhMsg);
diff --git a/CORE/MAC/src/cfg/cfgParamName.c b/CORE/MAC/src/cfg/cfgParamName.c
index 0a984ed..5c1580b 100644
--- a/CORE/MAC/src/cfg/cfgParamName.c
+++ b/CORE/MAC/src/cfg/cfgParamName.c
@@ -202,6 +202,38 @@
     (unsigned char *)"BASIC_MCS_SET",
     (unsigned char *)"CURRENT_MCS_SET",
     (unsigned char *)"GREENFIELD_CAPABILITY",
+    (unsigned char *)"VHT_MAX_MPDU_LENGTH",
+    (unsigned char *)"VHT_SUPPORTED_CHAN_WIDTH_SET",
+    (unsigned char *)"VHT_LDPC_CODING_CAP",
+    (unsigned char *)"VHT_SHORT_GI_80MHZ",
+    (unsigned char *)"VHT_SHORT_GI_160_AND_80_PLUS_80MHZ",
+    (unsigned char *)"VHT_TXSTBC",
+    (unsigned char *)"VHT_RXSTBC",
+    (unsigned char *)"VHT_SU_BEAMFORMER_CAP",
+    (unsigned char *)"VHT_SU_BEAMFORMEE_CAP",
+    (unsigned char *)"VHT_CSN_BEAMFORMEE_ANT_SUPPORTED",
+    (unsigned char *)"VHT_NUM_SOUNDING_DIMENSIONS",
+    (unsigned char *)"VHT_MU_BEAMFORMER_CAP",
+    (unsigned char *)"VHT_MU_BEAMFORMEE_CAP",
+    (unsigned char *)"VHT_TXOP_PS",
+    (unsigned char *)"VHT_HTC_VHTC_CAP",
+    (unsigned char *)"VHT_AMPDU_LEN_EXPONENT",
+    (unsigned char *)"VHT_LINK_ADAPTATION_CAP",
+    (unsigned char *)"VHT_RX_ANT_PATTERN",
+    (unsigned char *)"VHT_TX_ANT_PATTERN",
+    (unsigned char *)"VHT_RX_MCS_MAP",
+    (unsigned char *)"VHT_TX_MCS_MAP",
+    (unsigned char *)"VHT_RX_HIGHEST_SUPPORTED_DATA_RATE",
+    (unsigned char *)"VHT_TX_HIGHEST_SUPPORTED_DATA_RATE",
+    (unsigned char *)"VHT_CHANNEL_WIDTH",
+    (unsigned char *)"VHT_CHANNEL_CENTER_FREQ_SEGMENT1",
+    (unsigned char *)"VHT_CHANNEL_CENTER_FREQ_SEGMENT2",
+    (unsigned char *)"VHT_BASIC_MCS_SET",
+    (unsigned char *)"VHT_MU_MIMO_CAP_STA_COUNT",
+    (unsigned char *)"VHT_SS_UNDER_UTIL",
+    (unsigned char *)"VHT_40MHZ_UTILIZATION",
+    (unsigned char *)"VHT_80MHZ_UTILIZATION",
+    (unsigned char *)"VHT_160MHZ_UTILIZATION",
     (unsigned char *)"MAX_AMSDU_LENGTH",
     (unsigned char *)"MPDU_DENSITY",
     (unsigned char *)"MAX_RX_AMPDU_FACTOR",
diff --git a/CORE/MAC/src/cfg/cfgProcMsg.c b/CORE/MAC/src/cfg/cfgProcMsg.c
index a93bfe1..30bcbd8 100644
--- a/CORE/MAC/src/cfg/cfgProcMsg.c
+++ b/CORE/MAC/src/cfg/cfgProcMsg.c
@@ -415,7 +415,7 @@
     mmhMsg.bodyptr = NULL;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     if (wdaPostCtrlMsg(pMac, &mmhMsg) != eSIR_SUCCESS)
     {
         PELOGE(cfgLog(pMac, LOGE, FL("WDAPostMsgApi failed!\n"));)
diff --git a/CORE/MAC/src/cfg/cfgSendMsg.c b/CORE/MAC/src/cfg/cfgSendMsg.c
index 469d464..8f83143 100644
--- a/CORE/MAC/src/cfg/cfgSendMsg.c
+++ b/CORE/MAC/src/cfg/cfgSendMsg.c
@@ -139,7 +139,7 @@
     }
 
     // Ship it
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     SysProcessMmhMsg(pMac, &mmhMsg);
 
 } /*** end cfgSendHostMsg() ***/
diff --git a/CORE/MAC/src/cfg/cfgUtil/cfg.txt b/CORE/MAC/src/cfg/cfgUtil/cfg.txt
index ad07684..ed4e62d 100644
--- a/CORE/MAC/src/cfg/cfgUtil/cfg.txt
+++ b/CORE/MAC/src/cfg/cfgUtil/cfg.txt
@@ -604,10 +604,10 @@
 WNI_CFG_DOT11_MODE     I     4     9
 V    RW    NP RESTART
 LIM
-0    9    0
+0    11    0
 V    RW    NP RESTART
 LIM
-0    9    0
+0    11    0
 
 #ENUM  ALL           0
 #ENUM  11A           1
@@ -619,6 +619,8 @@
 #ENUM  TAURUS        7
 #ENUM  11G_ONLY      8
 #ENUM  11N_ONLY      9
+#ENUM  11AC          10
+#ENUM  11AC_ONLY     11
 
 
 
@@ -2244,10 +2246,10 @@
 WNI_CFG_CHANNEL_BONDING_MODE    I    4    12
 V    RW    NP    RESTART
 LIM
-0    4     0
+0    10     0
 V    RW    NP    RESTART
 LIM
-0    4     0
+0    10     0
 
 #ENUM DISABLE          0
 #ENUM ENABLE           1
@@ -2263,21 +2265,35 @@
 *  lower frequency). 
 *
 *  0 - There is no secondary channel. The channel is 20Mhz
-*  1 - LOWER:  Secondary channel is located below the primary channel
-*  2 - HIGHER: Secondary channel is located above the primary channel   
+*  1 - LOWER:  Secondary channel 40MHZ is located below the primary channel
+*  2 - CENTERED:Secondary channel and primary located at centered
+*  3 - HIGHER: Secondary channel 40 MHZ is located above the primary channel
+*  4 - 80MHZ_LOW_CENTERED : 20/40MHZ offset LOW 40/80MHZ offset CENTERED
+*  5 - 80MHZ_CENTERED_CENTERED : 20/40MHZ offset CENTERED 40/80MHZ offset CENTERED
+*  6 - 80MHZ_HIGH_CENTERED : 20/40MHZ offset HIGH 40/80MHZ offset CENTERED
+*  7 - 80MHZ_LOW_LOW: 20/40MHZ offset LOW 40/80MHZ offset LOW
+*  8 - 80MHZ_HIGH_LOW: 20/40MHZ offset HIGH 40/80MHZ offset LOW
+*  9 - 80MHZ_LOW_HIGH: 20/40MHZ offset LOW 40/80MHZ offset HIGH
+*  10 - 80MHZ_HIGH_HIGH: 20/40MHZ offset HIGH 40/80MHZ offset HIGH
 *
 WNI_CFG_CB_SECONDARY_CHANNEL_STATE    I    4    12
 V    RW    NP
 NONE
-0    2     0
+0    10     0
 V    RW    NP
 NONE
-0    2     0
+0    10     0
 
 #ENUM NONE             0
 #ENUM LOWER            1
 #ENUM HIGHER           2
-
+#ENUM 11AC_20MHZ_LOW_40MHZ_CENTERED       3
+#ENUM 11AC_20MHZ_CENTERED_40MHZ_CENTERED  4
+#ENUM 11AC_20MHZ_HIGH_40MHZ_CENTERED      5
+#ENUM 11AC_20MHZ_LOW_40MHZ_LOW            6
+#ENUM 11AC_20MHZ_HIGH_40MHZ_LOW           7
+#ENUM 11AC_20MHZ_LOW_40MHZ_HIGH           8
+#ENUM 11AC_20MHZ_HIGH_40MHZ_HIGH          9
 
 *************************************
 * Feature:   Dynamic Retry Rates
@@ -2693,6 +2709,385 @@
 #ENUM ENABLE    1
 #ENUM DISABLE   0
 
+*
+* Maximum AMPDU Length
+* By default set to zero for 3895 octets
+*
+WNI_CFG_VHT_MAX_MPDU_LENGTH  I    4    19
+V    RW    NP    
+LIM
+0    2    0
+V    RW    NP    
+LIM
+0    2    0
+
+*
+* Supported Channel Width Set
+* By default set to zero for 
+* STAs does not support either 160 or 80+80MHz
+*
+WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET  I    4    19
+V    RW    NP    
+LIM
+0    0    0
+V    RW    NP    
+LIM
+0    0    0
+
+*
+* LDPC Coding Capability
+* Riva/Pronto supports, default set to 1
+*
+WNI_CFG_VHT_LDPC_CODING_CAP  I    4    19
+V    RW    NP    
+LIM
+0    1    0
+V    RW    NP    
+LIM
+0    1    0
+
+*
+* Short GI for 80MHz
+* Riva/Pronto supports, default set to 1
+*
+WNI_CFG_VHT_SHORT_GI_80MHZ  I    4    19
+V    RW    NP    
+LIM
+0    1    1
+V    RW    NP    
+LIM
+0    1    1
+
+*
+* Short GI for 160MHz and 80+80MHz
+* Riva/Pronto does not supports, default set to 0
+*
+WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ  I    4    19
+V    RW    NP    
+LIM
+0    1    0
+V    RW    NP    
+LIM
+0    1    0
+
+*
+* Support for Transmission of 2x1 STBC
+* Riva/Pronto does not supports, default set to 0
+*
+WNI_CFG_VHT_TXSTBC  I    4    19
+V    RW    NP    
+LIM
+0    1    0
+V    RW    NP    
+LIM
+0    1    0
+
+*
+* Support for Reception of PPDUs using STBC
+* Riva/Pronto supports, default set to 1
+*
+WNI_CFG_VHT_RXSTBC  I    4    19
+V    RW    NP    
+LIM
+0    1    1
+V    RW    NP    
+LIM
+0    1    1
+
+*
+* Support for Operating as SU Beamformer
+* Riva/Pronto does not supports, default set to 0
+*
+WNI_CFG_VHT_SU_BEAMFORMER_CAP  I    4    19
+V    RW    NP    
+LIM
+0    1    0
+V    RW    NP    
+LIM
+0    1    0
+
+*
+* Support for Operating as SU Beamformee
+* Riva does not support, But Pronto supports, default set to 0
+*
+WNI_CFG_VHT_SU_BEAMFORMEE_CAP  I    4    19
+V    RW    NP    
+LIM
+0    1    1
+V    RW    NP    
+LIM
+0    1    1
+
+*
+* Compressed Steering Number of Beamformer Antennas Supported
+* Riva/Pronto does not support, default set to 0
+*
+WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED  I    4    19
+V    RW    NP    
+LIM
+0    1    0
+V    RW    NP    
+LIM
+0    1    0
+
+*
+* Number of Sounding Dimensions indicates Number
+* of antennas used by the beamformer when sending beamformed transmissions
+* Riva/Pronto does not support beamformer, default set to 0
+*
+WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS  I    4    19
+V    RW    NP    
+LIM
+0    1    1
+V    RW    NP    
+LIM
+0    1    1
+
+*
+* MU Beamformer Capable
+* Riva/Pronto does not support, default set to 0
+*
+WNI_CFG_VHT_MU_BEAMFORMER_CAP  I    4    19
+V    RW    NP    
+LIM
+0    1    0
+V    RW    NP    
+LIM
+0    1    0
+
+*
+* MU Beamformee Capable
+* Riva does not support but pronto supports, default set to 0
+*
+WNI_CFG_VHT_MU_BEAMFORMEE_CAP  I    4    19
+V    RW    NP    
+LIM
+0    1    0
+V    RW    NP    
+LIM
+0    1    0
+
+*
+* VHT TXOP PS
+* Riva does not support but pronto supports, default set to 0
+*
+WNI_CFG_VHT_TXOP_PS  I    4    19
+V    RW    NP    
+LIM
+0    1    0
+V    RW    NP    
+LIM
+0    1    0
+
+*
+* +HTC-VHT Capable
+* Riva does not support but pronto supports, default set to 0
+*
+WNI_CFG_VHT_HTC_VHTC_CAP  I    4    19
+V    RW    NP    
+LIM
+0    1    0
+V    RW    NP    
+LIM
+0    1    0
+
+*
+* Maximum AMPDU Length exponent range 0-7
+* 2^(13+Max AMPDU Length)-1, default set to 0
+*
+WNI_CFG_VHT_AMPDU_LEN_EXPONENT  I    4    19
+V    RW    NP    
+LIM
+0    7    3
+V    RW    NP    
+LIM
+0    7    3
+
+*
+* VHT Link Adaptation Capable
+* Riva does not support but pronto supports, default set to 0
+*
+WNI_CFG_VHT_LINK_ADAPTATION_CAP  I    4    19
+V    RW    NP    
+LIM
+0    3    0
+V    RW    NP    
+LIM
+0    3    0
+
+*
+* VHT Rx Antenna Pattern Consistency
+*
+WNI_CFG_VHT_RX_ANT_PATTERN  I    4    19
+V    RW    NP    
+LIM
+0    1    1
+V    RW    NP    
+LIM
+0    1    1
+
+*
+* VHT Tx Antenna Pattern Consistency
+*
+WNI_CFG_VHT_TX_ANT_PATTERN  I    4    19
+V    RW    NP    
+LIM
+0    1    1
+V    RW    NP    
+LIM
+0    1    1
+
+*
+* RxMCS Map is 16 bits, The 2bit Max MCS for n SS field.
+* Indicates the maximum MCS that can be received for each
+* number of spacial streams. Riva supports MCS 0-9
+*
+WNI_CFG_VHT_RX_MCS_MAP  I    4    19
+V    RW    NP    
+LIM
+0    0xFFFF    0xFFFE
+V    RW    NP    
+LIM
+0    0xFFFF    0xFFFE
+
+* TxMCS Map is 16 bits, The 2bit Max MCS for n SS field.
+* Indicates the maximum MCS that can be transmitted for each
+* number of spacial streams.
+*
+WNI_CFG_VHT_TX_MCS_MAP  I    4    19
+V    RW    NP    
+LIM
+0    0xFFFF    0xFFFE
+V    RW    NP    
+LIM
+0    0xFFFF    0xFFFE
+
+*
+* Rx Highest supported data rate.
+*
+WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE  I    4    19
+V    RW    NP    
+LIM
+1    434   434
+V    RW    NP    
+LIM
+1    434   434
+
+*
+* Tx Highest supported data rate.
+*
+WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE  I    4    19
+V    RW    NP    
+LIM
+1    434    434
+V    RW    NP    
+LIM
+1    434    434
+
+*
+* VHT Operation Information
+* Channel Width set to zero for 20/40MHz.
+* set to 1 for 80MHz. 2->160Mhz, 3->80+80MHz
+*
+WNI_CFG_VHT_CHANNEL_WIDTH  I    4    19
+V    RW    NP    
+LIM
+0    3    0
+V    RW    NP    
+LIM
+0    3    0
+
+#ENUM 20_40MHZ       0
+#ENUM 80MHZ          1
+#ENUM 160MHZ         2
+#ENUM 80_PLUS_80MHZ  3
+*
+* Channel center freq Seg1 
+*
+WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1  I    4    19
+V    RW    NP    
+LIM
+0    256   0 
+V    RW    NP    
+LIM
+0    256   0
+
+*
+* Channel center freq Seg2 for 80+80 Mhz
+*
+WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2  I    4    19
+V    RW    NP    
+LIM
+0    0     0 
+V    RW    NP    
+LIM
+0    0     0
+
+*
+* Basic MCS Set
+*
+WNI_CFG_VHT_BASIC_MCS_SET  I    4    19
+V    RW    NP    
+LIM
+0    3     0 
+V    RW    NP    
+LIM
+0    3     0
+
+*
+* MU-MIMO Capable STA Count
+*
+WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT  I    4    19
+V    RW    NP    
+LIM
+0     4    0 
+V    RW    NP    
+LIM
+0     4     0
+
+*
+* Spatial Stream Under-Utilization
+*
+WNI_CFG_VHT_SS_UNDER_UTIL  I    4    19
+V    RW    NP    
+LIM
+0     0    0 
+V    RW    NP    
+LIM
+0     0     0
+
+*
+* Forty MHZ Utilization
+*
+WNI_CFG_VHT_40MHZ_UTILIZATION  I    4    19
+V    RW    NP    
+LIM
+0     0    0 
+V    RW    NP    
+LIM
+0     0     0
+
+*
+* Eighty MHz Utilization
+*
+WNI_CFG_VHT_80MHZ_UTILIZATION  I    4    19
+V    RW    NP    
+LIM
+0     0    0 
+V    RW    NP    
+LIM
+0     0     0
+
+*
+* Hundred Sixty MHz Utilization
+*
+WNI_CFG_VHT_160MHZ_UTILIZATION  I    4    19
+V    RW    NP    
+LIM
+0     0    0 
+V    RW    NP    
+LIM
+0     0     0
 
 *
 * Maximum AMSDU length
diff --git a/CORE/MAC/src/include/dot11f.h b/CORE/MAC/src/include/dot11f.h
index 7fe0dc4..d4657b1 100644
--- a/CORE/MAC/src/include/dot11f.h
+++ b/CORE/MAC/src/include/dot11f.h
@@ -35,7 +35,7 @@
   *
   *
   * This file was automatically generated by 'framesc'
-  * Tue May 15 13:12:01 2012 from the following file(s):
+  * Fri Aug 17 13:25:06 2012 from the following file(s):
   *
   * dot11f.frms
   * 
@@ -5005,6 +5005,113 @@
 #ifdef __cplusplus
 }; /* End extern "C". */
 #endif /* C++ */
+// EID 191 (0xbf)
+typedef struct sDot11fIEVHTCaps {
+    tANI_U8      present;
+    tANI_U32       maxMPDULen: 2;
+    tANI_U32 supportedChannelWidthSet: 2;
+    tANI_U32    ldpcCodingCap: 1;
+    tANI_U32     shortGI80MHz: 1;
+    tANI_U32 shortGI160and80plus80MHz: 1;
+    tANI_U32           txSTBC: 1;
+    tANI_U32           rxSTBC: 3;
+    tANI_U32  suBeamFormerCap: 1;
+    tANI_U32  suBeamformeeCap: 1;
+    tANI_U32 csnofBeamformerAntSup: 3;
+    tANI_U32   numSoundingDim: 3;
+    tANI_U32  muBeamformerCap: 1;
+    tANI_U32  muBeamformeeCap: 1;
+    tANI_U32        vhtTXOPPS: 1;
+    tANI_U32        htcVHTCap: 1;
+    tANI_U32   maxAMPDULenExp: 3;
+    tANI_U32  vhtLinkAdaptCap: 2;
+    tANI_U32     rxAntPattern: 1;
+    tANI_U32     txAntPattern: 1;
+    tANI_U32        reserved1: 2;
+    tANI_U16     rxMCSMap;
+    tANI_U16 rxHighSupDataRate: 13;
+    tANI_U16        reserved2: 3;
+    tANI_U16     txMCSMap;
+    tANI_U16    txSupDataRate: 13;
+    tANI_U16        reserved3: 3;
+} tDot11fIEVHTCaps;
+
+#define DOT11F_EID_VHTCAPS ( 191 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_VHTCAPS_MIN_LEN ( 12 )
+
+#define DOT11F_IE_VHTCAPS_MAX_LEN ( 12 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeVHTCaps(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEVHTCaps*);
+
+tANI_U32 dot11fPackIeVHTCaps(tpAniSirGlobal, tDot11fIEVHTCaps*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEVHTCaps(tpAniSirGlobal, tDot11fIEVHTCaps*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 193 (0xc1)
+typedef struct sDot11fIEVHTExtBssLoad {
+    tANI_U8      present;
+    tANI_U8      muMIMOCapStaCount;
+    tANI_U8      ssUnderUtil;
+    tANI_U8      FortyMHzUtil;
+    tANI_U8      EightyMHzUtil;
+    tANI_U8      OneSixtyMHzUtil;
+} tDot11fIEVHTExtBssLoad;
+
+#define DOT11F_EID_VHTEXTBSSLOAD ( 193 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_VHTEXTBSSLOAD_MIN_LEN ( 5 )
+
+#define DOT11F_IE_VHTEXTBSSLOAD_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeVHTExtBssLoad(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEVHTExtBssLoad*);
+
+tANI_U32 dot11fPackIeVHTExtBssLoad(tpAniSirGlobal, tDot11fIEVHTExtBssLoad*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEVHTExtBssLoad(tpAniSirGlobal, tDot11fIEVHTExtBssLoad*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
+// EID 192 (0xc0)
+typedef struct sDot11fIEVHTOperation {
+    tANI_U8      present;
+    tANI_U8      chanWidth;
+    tANI_U8      chanCenterFreqSeg1;
+    tANI_U8      chanCenterFreqSeg2;
+    tANI_U16     basicMCSSet;
+} tDot11fIEVHTOperation;
+
+#define DOT11F_EID_VHTOPERATION ( 192 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_VHTOPERATION_MIN_LEN ( 5 )
+
+#define DOT11F_IE_VHTOPERATION_MAX_LEN ( 5 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeVHTOperation(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEVHTOperation*);
+
+tANI_U32 dot11fPackIeVHTOperation(tpAniSirGlobal, tDot11fIEVHTOperation*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEVHTOperation(tpAniSirGlobal, tDot11fIEVHTOperation*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
 // EID 68 (0x44)
 typedef struct sDot11fIEWAPI {
     tANI_U8      present;
@@ -5091,6 +5198,32 @@
 #ifdef __cplusplus
 }; /* End extern "C". */
 #endif /* C++ */
+// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x0a}
+typedef struct sDot11fIEWFDIEOpaque {
+    tANI_U8      present;
+    tANI_U8      num_data;
+    tANI_U8      data[249];
+} tDot11fIEWFDIEOpaque;
+
+#define DOT11F_EID_WFDIEOPAQUE ( 221 )
+
+// N.B. These #defines do *not* include the EID & length
+#define DOT11F_IE_WFDIEOPAQUE_MIN_LEN ( 6 )
+
+#define DOT11F_IE_WFDIEOPAQUE_MAX_LEN ( 253 )
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */
+tANI_U32 dot11fUnpackIeWFDIEOpaque(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWFDIEOpaque*);
+
+tANI_U32 dot11fPackIeWFDIEOpaque(tpAniSirGlobal, tDot11fIEWFDIEOpaque*, tANI_U8*, tANI_U32, tANI_U32*);
+
+tANI_U32 dot11fGetPackedIEWFDIEOpaque(tpAniSirGlobal, tDot11fIEWFDIEOpaque*, tANI_U32*);
+
+#ifdef __cplusplus
+}; /* End extern "C". */
+#endif /* C++ */
 // EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x05}
 typedef struct sDot11fIEWMMCaps {
     tANI_U8      present;
@@ -5736,6 +5869,8 @@
     tDot11fIECCXRadMgmtCap  CCXRadMgmtCap;
     tDot11fIECCXVersion     CCXVersion;
     tDot11fIEP2PIEOpaque    P2PIEOpaque;
+    tDot11fIEWFDIEOpaque    WFDIEOpaque;
+    tDot11fIEVHTCaps        VHTCaps;
 } tDot11fAssocRequest;
 
 #define DOT11F_ASSOCREQUEST ( 5 )
@@ -5779,6 +5914,8 @@
     tDot11fIEAirgo          Airgo;
     tDot11fIEWscAssocRes    WscAssocRes;
     tDot11fIEP2PAssocRes    P2PAssocRes;
+    tDot11fIEVHTCaps        VHTCaps;
+    tDot11fIEVHTOperation   VHTOperation;
 } tDot11fAssocResponse;
 
 #define DOT11F_ASSOCRESPONSE ( 6 )
@@ -5863,6 +6000,9 @@
     tDot11fIEAirgo            Airgo;
     tDot11fIEWscBeacon        WscBeacon;
     tDot11fIEP2PBeacon        P2PBeacon;
+    tDot11fIEVHTCaps          VHTCaps;
+    tDot11fIEVHTOperation     VHTOperation;
+    tDot11fIEVHTExtBssLoad    VHTExtBssLoad;
 } tDot11fBeacon;
 
 #define DOT11F_BEACON ( 8 )
@@ -5930,6 +6070,9 @@
     tDot11fIECCXTrafStrmMet   CCXTrafStrmMet;
     tDot11fIECCXTxmitPower    CCXTxmitPower;
     tDot11fIEP2PBeacon        P2PBeacon;
+    tDot11fIEVHTCaps          VHTCaps;
+    tDot11fIEVHTOperation     VHTOperation;
+    tDot11fIEVHTExtBssLoad    VHTExtBssLoad;
 } tDot11fBeacon2;
 
 #define DOT11F_BEACON2 ( 10 )
@@ -5985,6 +6128,9 @@
     tDot11fIEAirgo             Airgo;
     tDot11fIEWscBeaconProbeRes WscBeaconProbeRes;
     tDot11fIEP2PBeaconProbeRes P2PBeaconProbeRes;
+    tDot11fIEVHTCaps           VHTCaps;
+    tDot11fIEVHTOperation      VHTOperation;
+    tDot11fIEVHTExtBssLoad     VHTExtBssLoad;
 } tDot11fBeaconIEs;
 
 #define DOT11F_BEACONIES ( 11 )
@@ -6498,6 +6644,7 @@
     tDot11fIEWscProbeReq   WscProbeReq;
     tDot11fIEWFATPC        WFATPC;
     tDot11fIEP2PProbeReq   P2PProbeReq;
+    tDot11fIEVHTCaps       VHTCaps;
 } tDot11fProbeRequest;
 
 #define DOT11F_PROBEREQUEST ( 34 )
@@ -6553,6 +6700,9 @@
     tDot11fIEAirgo            Airgo;
     tDot11fIEWscProbeRes      WscProbeRes;
     tDot11fIEP2PProbeRes      P2PProbeRes;
+    tDot11fIEVHTCaps          VHTCaps;
+    tDot11fIEVHTOperation     VHTOperation;
+    tDot11fIEVHTExtBssLoad    VHTExtBssLoad;
 } tDot11fProbeResponse;
 
 #define DOT11F_PROBERESPONSE ( 35 )
@@ -6690,6 +6840,8 @@
     tDot11fIEWMMTSPEC           WMMTSPEC[4];
     tDot11fIECCXTrafStrmRateSet CCXTrafStrmRateSet;
     tDot11fIEP2PIEOpaque        P2PIEOpaque;
+    tDot11fIEWFDIEOpaque        WFDIEOpaque;
+    tDot11fIEVHTCaps            VHTCaps;
 } tDot11fReAssocRequest;
 
 #define DOT11F_REASSOCREQUEST ( 40 )
@@ -6734,6 +6886,8 @@
     tDot11fIEAirgo              Airgo;
     tDot11fIEWscReassocRes      WscReassocRes;
     tDot11fIEP2PAssocRes        P2PAssocRes;
+    tDot11fIEVHTCaps            VHTCaps;
+    tDot11fIEVHTOperation       VHTOperation;
 } tDot11fReAssocResponse;
 
 #define DOT11F_REASSOCRESPONSE ( 41 )
diff --git a/CORE/MAC/src/include/dphGlobal.h b/CORE/MAC/src/include/dphGlobal.h
index 56e5ed9..9a53caf 100644
--- a/CORE/MAC/src/include/dphGlobal.h
+++ b/CORE/MAC/src/include/dphGlobal.h
@@ -21,352 +21,638 @@
 
 /*
  *
+
  * Airgo Networks, Inc proprietary. All rights reserved.
  * Author:      Sandesh Goel
+
  * Date:        02/25/02
+
  * History:-
+
  * Date            Modified by    Modification Information
+
  * --------------------------------------------------------------------
+
  *
+
  */
 
+
 #ifndef __DPH_GLOBAL_H__
+
 #define __DPH_GLOBAL_H__
 
+
 #include "limGlobal.h"
+
 //#include "parserApi.h"
+
 #include "sirMacProtDef.h"
+
 #include "sirMacPropExts.h"
+
 #include "sirApi.h"
 
+
 /// Following determines whether statistics are maintained or not
+
 #define DPH_STATS
 
+
 /// traffic category not allowed
+
 #define DPH_TID_NOTALLOWED           0xFF
 
+
 /// Periodicity of invocation of rate adaptation (in ms)
+
 #define DPH_RATE_ADAPTATION_PERIOD     20
 
+
 // Rate indices
+
 #define DPH_PHY_RATE_1_INDEX     0
+
 #define DPH_PHY_RATE_2_INDEX     1
+
 #define DPH_PHY_RATE_5_5_INDEX   2
+
 #define DPH_PHY_RATE_11_INDEX    3
+
 #define DPH_PHY_RATE_6_INDEX     4
+
 #define DPH_PHY_RATE_9_INDEX     5
+
 #define DPH_PHY_RATE_12_INDEX    6
+
 #define DPH_PHY_RATE_18_INDEX    7
+
 #define DPH_PHY_RATE_24_INDEX    8
+
 #define DPH_PHY_RATE_36_INDEX    9
+
 #define DPH_PHY_RATE_48_INDEX   10
+
 #define DPH_PHY_RATE_54_INDEX   11
+
 #define DPH_PHY_RATE_72_INDEX   12
+
 #define DPH_PHY_RATE_96_INDEX   13
+
 #define DPH_PHY_RATE_108_INDEX  14
+
 #define DPH_PHY_RATE_144_INDEX  15
+
 #define DPH_PHY_RATE_MAX_INDEX  16
 
+
 /// Maximum time to wait for a management packet to go out (ms)
+
 #define DPH_MAX_MGMT_WAIT_TIME  10000
 
+
 /// Step size for the wait time histogram (ms)
+
 #define DPH_WAIT_HIST_STEP 20
 
+
 /// Number of entries in wait time histogram
+
 #define DPH_WAIT_HIST_SIZE  100
 
+
 /// TCID for Management & Keep Alive Mgmt frames
+
 #define DPH_MGMT_TCID                      4
+
 #define DPH_KEEPALIVE_PROBE_RESPONSE_TCID  0
 
+
 /// STAID for Management frames
+
 #define DPH_USE_MGMT_STAID  -1
 
+
 // Keep Alive frames
+
 #define DPH_NON_KEEPALIVE_FRAME  0
+
 #define DPH_KEEPALIVE_FRAME      1
 
+
 /// Mask for subtype, type, protocol version, order and wep fields in the mac frame control
+
 #define DPH_FC_BD_FILL_MASK  0xFFCC
 
+
 /// Enable/Disable Txop generation in TFP for HCF mode
+
 #define DPH_ENABLE_HCF_TXOP_GEN_AT_TFP   0x00
+
 #define DPH_DISABLE_HCF_TXOP_GEN_AT_TFP  0x02
 
+
 /// Enable/Disable Txop generation in TFP for EDCF mode
+
 #define DPH_ENABLE_EDCF_TXOP_GEN_AT_TFP   0x00
+
 #define DPH_DISABLE_EDCF_TXOP_GEN_AT_TFP  0x01
 
+
 #define DPH_DUMP_ALL_STA_ID     -1
+
 #define DPH_DUMP_RX_BD           0
+
 #define DPH_DUMP_TX_BD           1
+
 #define DPH_DUMP_TX_MGMT_BD      2
 
+
 //DPH Hash Index for BSS(STA's Peer) on station.
+
 #define DPH_STA_HASH_INDEX_PEER   1
 
+
 typedef struct sDphRateBasedCtr
+
 {
+
     tANI_U32 hi;
+
     tANI_U32 lo;
+
 } tDphRateBasedCtr;
 
+
 typedef struct sDphPhyRates
+
 {
+
     tANI_U8 dataRateX2;
+
     tANI_U8 ackRateX2;
+
     tANI_U8 rtsRateX2;
+
 } tDphPhyRates;
 
+
 typedef struct sDphIFSValues
+
 {
+
     tANI_U8 sifs;
+
     tANI_U8 pifs;
+
     tANI_U8 difs;
+
     tANI_U8 preamble;
+
 } tDphIFSValues;
 
+
 typedef struct sDphQosParams
+
 {
+
     tANI_U8                   addtsPresent;
+
     tSirAddtsReqInfo       addts;
+
     tSirMacQosCapabilityStaIE capability;
+
 } tDphQosParams;
 
+
 /// Queue attribute structure
+
 typedef struct sDphQueueAttr
+
 {
+
     tANI_U16     valid : 1;
+
     tANI_U16     seqNum : 12;
+
     tANI_U16     ackPolicy : 2;
+
     tANI_U16     rsvd : 1;
+
 } tDphQueueAttr, *tpDphQueueAttr;
 
+
 #if defined( FEATURE_WLAN_INTEGRATED_SOC )
+
 typedef struct sCfgTrafficClass {
+
     //Use Block ACK on this STA/TID
+
     // Fields used to store the default TC parameters for this TSPEC.
+
     // They will be used when the TSPEC is deleted.
+
     tANI_U8 fDisableTx:1;
+
     tANI_U8 fDisableRx:1;
+
     tANI_U8 fUseBATx:1;
+
     tANI_U8 fUseBARx:1;
 
+
     // 1: expect to see frames with compressed BA coming from this peer MAC
+
     tANI_U8 fRxCompBA:1;
+
     tANI_U8 fTxCompBA:1;
 
+
     // immediate ACK or delayed ACK for frames from this peer MAC
+
     tANI_U8 fRxBApolicy:1;
 
+
     // immediate ACK or delayed ACK for frames to this peer MAC
+
     tANI_U8 fTxBApolicy:1;
 
+
     //Initiator or recipient
+
     tANI_U8 role;
 
+
     //Max # of MSDU received from this STA, negotiated at ADDBA
+
     // used for maintaining block ack state info
+
     tANI_U16 rxBufSize;
 
+
     //Max # of MSDU send to this STA, negotiated at ADDBA
+
     tANI_U16 txBufSize;
 
+
     //BA timeout negotiated at ADDBA. Unit: TU
+
     tANI_U16 tuTxBAWaitTimeout; //Time for Tx to wait for BA. 0 means no timeout
 
+
     tANI_U16 tuRxBAWaitTimeout; //Time for Rx to wait for explicit/implicit BAR. 0 means no timeout
 
+
 } tCfgTrafficClass;
+
 #endif /* EATURE_WLAN_INTEGRATED_SOC */
 
+
 /// STA state node
+
 typedef struct sDphHashNode
+
 {
 
+
     //BYTE 0
+
     // HASH ENTRY FIELDS NOT NEEDED IN HAL.
+
     /// This STA valid or not
+
     tANI_U8   valid : 1;
+
     tANI_U8   encPolicy : 3;
+
     tANI_U8   defaultKey : 1;
+
     tANI_U8   defaultKeyId : 2;
+
     tANI_U8   qosMode : 1;
 
+
     //BYTE 1
+
     tANI_U8   erpEnabled : 1;
+
     tANI_U8   added : 1; // This has been added to the dph hash table
+
     tANI_U8   linkTestOn : 1;
+
     tANI_U8   shortPreambleEnabled : 1;
+
     tANI_U8   shortSlotTimeEnabled : 1;
+
     tANI_U8   stopTx:1;
+
     tANI_U8   wmeEnabled: 1; // set if both ap and sta are wme capable
+
     tANI_U8   lleEnabled: 1; // set if both ap and sta are 11e capable
 
+
     //BYTE 2
+
     tANI_U8   wsmEnabled: 1; // set if both ap and sta are wsm capable
+
     tANI_U8   versionPresent:1; // station gave version info
+
     tANI_U8   burstEnableForce:1; // allow bursting regardless of qosMode
+
     tANI_U8   staAuthenticated:1;    
+
     /// Whether the peer is ANI or not
+
     tANI_U8  aniPeer:1;
+
     tANI_U8   titanPeer:1;                // flag to indicate if its a titan peer    
+
     tANI_U8  fAniCount:1;
+
 #if (WNI_POLARIS_FW_PRODUCT == AP)
+
     tANI_U8   hcfEnabled : 1;
+
 #else
+
     tANI_U8   rsvd:1;
+
 #endif
 
+
     /// Fragmentation size
+
     tANI_U16   fragSize;
 
+
     /// LIM state
+
     tLimMlmStaContext mlmStaContext;
 
+
     /// Number of Tim to wait if the STA doesn't respond / fetch data
+
     tANI_U8  timWaitCount;
 
+
     /// Number of Successfull MPDU's being sent
+
     tANI_U32    curTxMpduCnt;
 
 
+
+
     /// number of consecutive TIMs sent without response
+
     tANI_U8  numTimSent;
 
+
     // qos parameter info
+
     tDphQosParams  qos;
 
+
     // station version info - valid only if versionPresent is set
+
     tSirMacPropVersion version;
+
     // station proprietary capability
+
     tANI_U16                propCapability;
 
+
 #ifdef PLM_WDS
+
     tANI_U8  wdsIndex;
+
     tANI_U8  wdsPeerBeaconSeen;
+
 #endif
 
+
    //Taurus capabilities
+
    tANI_U16 baPolicyFlag;                 //BA Policy for each TID. 
 
+
     /*
+
     * All the legacy and airgo supported rates.
+
     */
+
     tSirSupportedRates supportedRates;
 
+
     tANI_U8 htGreenfield:1;
+
     tANI_U8 htShortGI40Mhz:1;
+
     tANI_U8 htShortGI20Mhz:1;
+
     // DSSS/CCK at 40 MHz: Enabled 1 or Disabled
+
     tANI_U8 htDsssCckRate40MHzSupport:1;
+
     // L-SIG TXOP Protection used only if peer support available
+
     tANI_U8 htLsigTXOPProtection:1;
+
     // A-MPDU Density
+
     // 000 - No restriction
+
     // 001 - 1/8 usec
+
     // 010 - 1/4 usec
+
     // 011 - 1/2 usec
+
     // 100 - 1 usec
+
     // 101 - 2 usec
+
     // 110 - 4 usec
+
     // 111 - 8 usec
+
     //
+
     tANI_U8 htAMpduDensity:3;
 
 
+
+
     //Set to 0 for 3839 octets
+
     //Set to 1 for 7935 octets
+
     tANI_U8 htMaxAmsduLength;
 
 
+
+
     // MIMO Power Save
+
     tSirMacHTMIMOPowerSaveState htMIMOPSState;
 
+
     //
 
+
     // Maximum Rx A-MPDU factor
+
     tANI_U8 htMaxRxAMpduFactor:2;
+
     //
+
     // Recommended Tx Width Set
+
     // 0 - use 20 MHz channel (control channel)
+
     // 1 - use 40 Mhz channel
+
     //
+
     tANI_U8 htSupportedChannelWidthSet:1;
-    tANI_U8 rsvd1:5;
+    tANI_U8 htSecondaryChannelOffset:2;
+    tANI_U8 rsvd1:3;
+
 
     ///////////////////////////////////////////////////////////////////////
+
     // DPH HASH ENTRY FIELDS NEEDED IN HAL ONLY
+
     ///////////////////////////////////////////////////////////////////////
+
     tANI_U8 dpuSig:4;                       // DPU signiture
+
     tANI_U8 staSig:4;                       // STA signature
+
     tANI_U8 staType;
 
+
     tANI_U16 bssId;                          // BSSID
+
     tANI_U16 assocId;                       // Association ID
 
 
+
+
     //This is the real sta index generated by HAL
+
     tANI_U16 staIndex;
+
     tANI_U8    staAddr[6];
+
     /*The DPU signatures will be sent eventually to TL to help it determine the 
+
       association to which a packet belongs to*/
+
     /*Unicast DPU signature*/
+
     tANI_U8     ucUcastSig;
 
+
     /*Broadcast DPU signature*/
+
     tANI_U8     ucBcastSig;
 
+
     //
+
     // PE needs this info on a per-STA, per-TID basis
+
     // At any point in time, when this data is sampled,
+
     // it gives a measure of:
+
     // a) All the active bA sessions
+
     // b) And the BA configuration itself
+
     //
+
     tCfgTrafficClass tcCfg[STACFG_MAX_TC];
 
+
     // Block Ack state
+
     // This is used between PE and HAL only.
+
     // can be set to one of the values from the following enum
+
     /*typedef enum eLimBAState
+
     {
+
         eLIM_BA_STATE_IDLE, // we are not waiting for anything from HAL.
+
         eLIM_BA_STATE_WT_ADD_RSP, //We are waiting for Add rsponse from HAL.
+
         eLIM_BA_STATE_WT_DEL_RSP //  We are waiting for Del response from HAL.
+
     } tLimBAState; */
 
 
+
+
     //BA state bitmap 2 bits per tid
+
     // BA state for tid i  = (baState >> tid*2) & 0x3
+
     tANI_U32 baState;
 
+#ifdef WLAN_FEATURE_11AC
+    tANI_U8  vhtSupportedChannelWidthSet;
+#endif
+
     /* When a station with already an existing dph entry tries to 
+
      * associate again, the old dph entry will be zeroed out except 
+
      * for the next pointer. The next pointer must be defined at the  
+
      * end of the structure.
+
      */
+
     struct sDphHashNode  *next;
 
+
 } tDphHashNode, *tpDphHashNode;
 
+
 #include "dphHashTable.h"
 
+
 // -------------------------------------------------------------------
 
+
 // get protection overrides from config variable
+
 // bit0: force cts to self protection for tx to Airgo peers
+
 // bit1: force cts to self protection for tx to non Airgo peers
+
 #define DPH_PROT_OVERRIDE_NONANI_PEER_GET(cfgval)    ((cfgval) & 1)
+
 #define DPH_PROT_OVERRIDE_ANI_PEER_GET(cfgval) (((cfgval) & 2) >> 1)
 
+
 typedef struct sAniSirDph
+
 {
+
     /// The hash table object
+
     dphHashTableClass dphHashTable;
+
 } tAniSirDph, *tpAniSirDph;
 
+
 #endif
 
 
+
+
diff --git a/CORE/MAC/src/include/parserApi.h b/CORE/MAC/src/include/parserApi.h
index ac63e09..a28f43d 100644
--- a/CORE/MAC/src/include/parserApi.h
+++ b/CORE/MAC/src/include/parserApi.h
@@ -124,6 +124,12 @@
     tANI_U8                   mdiePresent;
 #endif
 
+#ifdef WLAN_FEATURE_11AC
+    tDot11fIEVHTCaps          VHTCaps;
+    tDot11fIEVHTOperation     VHTOperation;
+    tDot11fIEVHTExtBssLoad    VHTExtBssLoad;
+#endif
+
 } tSirProbeRespBeacon, *tpSirProbeRespBeacon;
 
 // probe Request structure
@@ -139,6 +145,10 @@
     tANI_U8                   extendedRatesPresent;
     tANI_U8                   wscIePresent;
     tANI_U8                   p2pIePresent;
+#ifdef WLAN_FEATURE_11AC
+    tDot11fIEVHTCaps          VHTCaps;
+#endif
+
 
 } tSirProbeReq, *tpSirProbeReq;
 
@@ -191,6 +201,9 @@
     tANI_U32                  assocReqFrameLength;
     tANI_U8*                  assocReqFrame;
 #endif
+#ifdef WLAN_FEATURE_11AC
+    tDot11fIEVHTCaps          VHTCaps;
+#endif
 } tSirAssocReq, *tpSirAssocReq;
 
 
@@ -238,6 +251,10 @@
     tANI_U8                   tspecPresent;
     tANI_U8                   tsmPresent;
 #endif    
+#ifdef WLAN_FEATURE_11AC
+    tDot11fIEVHTCaps          VHTCaps;
+    tDot11fIEVHTOperation     VHTOperation;
+#endif
 } tSirAssocRsp, *tpSirAssocRsp;
 
 tANI_U8
@@ -423,12 +440,14 @@
 /// Populate a tDot11fIEChanSwitchAnn
 void
 PopulateDot11fChanSwitchAnn(tpAniSirGlobal          pMac,
-                            tDot11fIEChanSwitchAnn *pDot11f);
+                            tDot11fIEChanSwitchAnn *pDot11f,
+                            tpPESession psessionEntry);
 
 /// Populate a tDot11fIEChanSwitchAnn
 void
 PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal          pMac,
-                             tDot11fIEExtChanSwitchAnn *pDot11f);
+                             tDot11fIEExtChanSwitchAnn *pDot11f,
+                             tpPESession psessionEntry);
 
 /// Populate a tDot11fIECountry
 tSirRetStatus
@@ -498,7 +517,8 @@
 
 tSirRetStatus
 PopulateDot11fHTCaps(tpAniSirGlobal           pMac,
-                             tDot11fIEHTCaps *pDot11f);
+                           tpPESession      psessionEntry,
+                           tDot11fIEHTCaps *pDot11f);
 
 #ifdef WLAN_SOFTAP_FEATURE
 tSirRetStatus
@@ -843,3 +863,15 @@
                            tpSirRSNie pRsnIe,
                            tANI_U8 EID);
 #endif
+
+#ifdef WLAN_FEATURE_11AC
+tSirRetStatus
+PopulateDot11fVHTCaps(tpAniSirGlobal  pMac, tDot11fIEVHTCaps *pDot11f);
+
+tSirRetStatus
+PopulateDot11fVHTOperation(tpAniSirGlobal  pMac, tDot11fIEVHTOperation  *pDot11f);
+
+tSirRetStatus
+PopulateDot11fVHTExtBssLoad(tpAniSirGlobal  pMac, tDot11fIEVHTExtBssLoad   *pDot11f);
+
+#endif
diff --git a/CORE/MAC/src/include/sirParams.h b/CORE/MAC/src/include/sirParams.h
index 02da0c9..02bec73 100644
--- a/CORE/MAC/src/include/sirParams.h
+++ b/CORE/MAC/src/include/sirParams.h
@@ -49,13 +49,32 @@
 #if defined( FEATURE_WLAN_INTEGRATED_SOC )
 typedef enum
 {
-    PHY_SINGLE_CHANNEL_CENTERED = 0,        // 20MHz IF bandwidth centered on IF carrier
-    PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1,     // 40MHz IF bandwidth with lower 20MHz supporting the primary channel
-    //not allowed PHY_DOUBLE_CHANNEL_CENTERED = 2,        // 40MHz IF bandwidth centered on IF carrier
-    PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3     // 40MHz IF bandwidth with higher 20MHz supporting the primary channel
+    PHY_SINGLE_CHANNEL_CENTERED     = 0,        // 20MHz IF bandwidth centered on IF carrier
+    PHY_DOUBLE_CHANNEL_LOW_PRIMARY  = 1,        // 40MHz IF bandwidth with lower 20MHz supporting the primary channel
+    PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3,        // 40MHz IF bandwidth with higher 20MHz supporting the primary channel
+#ifdef WLAN_FEATURE_11AC    
+    PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED = 4, //20/40MHZ offset LOW 40/80MHZ offset CENTERED
+    PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED = 5, //20/40MHZ offset CENTERED 40/80MHZ offset CENTERED
+    PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED = 6, //20/40MHZ offset HIGH 40/80MHZ offset CENTERED
+    PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW = 7,//20/40MHZ offset LOW 40/80MHZ offset LOW
+    PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW = 8, //20/40MHZ offset HIGH 40/80MHZ offset LOW
+    PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH = 9, //20/40MHZ offset LOW 40/80MHZ offset HIGH
+    PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH = 10,//20/40MHZ offset-HIGH 40/80MHZ offset HIGH
+#endif
+    PHY_CHANNEL_BONDING_STATE_MAX   = 11
 }ePhyChanBondState;
 #endif /* FEATURE_WLAN_INTEGRATED_SOC */
 
+#define SIR_MIN(a,b)   (((a) < (b)) ? (a) : (b))
+#define SIR_MAX(a,b)   (((a) > (b)) ? (a) : (b))
+
+typedef enum {
+   MCC	   = 0,
+   P2P	   = 1,
+   DOT11AC = 2,
+   MAX_FEATURE_SUPPORTED = 128,
+} placeHolderInCapBitmap;
+
 typedef enum eSriLinkState {
     eSIR_LINK_IDLE_STATE        = 0,
     eSIR_LINK_PREASSOC_STATE    = 1,
@@ -135,7 +154,10 @@
      */
     tANI_U16 msgLen;
 
-    tANI_U32 sessionId;
+    tANI_U8 sessionId;
+    tANI_U8 noack;
+    tANI_U16 wait;
+
     /**
      * This is the first data word in the mailbox message.
      * It is followed by n words of data.
@@ -423,6 +445,12 @@
 #ifdef ANI_CHIPSET_VOLANS
 /* PE <-> HAL addr2 mismatch message */
 #define SIR_LIM_ADDR2_MISS_IND             SIR_HAL_ITC_MSG_TYPES_BEGIN + 142
+#ifdef FEATURE_OEM_DATA_SUPPORT
+/* PE <-> HAL OEM_DATA RELATED MESSAGES */
+#define SIR_HAL_START_OEM_DATA_REQ         SIR_HAL_ITC_MSG_TYPES_BEGIN + 143
+#define SIR_HAL_START_OEM_DATA_RSP       SIR_HAL_ITC_MSG_TYPES_BEGIN + 144
+#define SIR_HAL_FINISH_OEM_DATA_REQ      SIR_HAL_ITC_MSG_TYPES_BEGIN + 145
+#endif
 #endif
 
 #define SIR_HAL_SET_MAX_TX_POWER_REQ       SIR_HAL_ITC_MSG_TYPES_BEGIN + 146
@@ -519,10 +547,10 @@
 // LIM message types
 #define SIR_LIM_MSG_TYPES_BEGIN        (SIR_LIM_MODULE_ID << 8)
 #define SIR_LIM_ITC_MSG_TYPES_BEGIN    SIR_LIM_MSG_TYPES_BEGIN+0xB0
+
 // Messages to/from HAL
-#define SIR_LIM_RESUME_ACTIVITY_NTF        SIR_LIM_ITC_MSG_TYPES_BEGIN
-#define SIR_LIM_SUSPEND_ACTIVITY_REQ       SIR_LIM_ITC_MSG_TYPES_BEGIN + 1
-#define SIR_HAL_SUSPEND_ACTIVITY_RSP       SIR_LIM_ITC_MSG_TYPES_BEGIN + 2
+// Removed as part of moving HAL down to FW
+
 // Message from ISR upon TFP retry interrupt
 #define SIR_LIM_RETRY_INTERRUPT_MSG        SIR_LIM_ITC_MSG_TYPES_BEGIN + 3
 // Message from BB Transport
diff --git a/CORE/MAC/src/pe/include/limAdmitControl.h b/CORE/MAC/src/pe/include/limAdmitControl.h
index 158a94a..123564a 100644
--- a/CORE/MAC/src/pe/include/limAdmitControl.h
+++ b/CORE/MAC/src/pe/include/limAdmitControl.h
@@ -92,7 +92,7 @@
 tSirRetStatus limAdmitControlInit(tpAniSirGlobal pMac);
 
 tSirRetStatus limSendHalMsgAddTs(tpAniSirGlobal pMac, tANI_U16 staIdx, tANI_U8 tspecIdx, tSirMacTspecIE tspecIE, tANI_U8 sessionId);
-tSirRetStatus limSendHalMsgDelTs(tpAniSirGlobal pMac,  tANI_U16 staIdx,  tANI_U8 tspecIdx,  tSirDeltsReqInfo delts);
+tSirRetStatus limSendHalMsgDelTs(tpAniSirGlobal pMac,  tANI_U16 staIdx,  tANI_U8 tspecIdx,  tSirDeltsReqInfo delts, tANI_U8 sessionId);
 void limProcessHalAddTsRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
 
 #endif
diff --git a/CORE/MAC/src/pe/include/limApi.h b/CORE/MAC/src/pe/include/limApi.h
index e0f2a4d..7e1a88a 100644
--- a/CORE/MAC/src/pe/include/limApi.h
+++ b/CORE/MAC/src/pe/include/limApi.h
@@ -33,7 +33,6 @@
  */
 #ifndef __LIM_API_H
 #define __LIM_API_H
-
 #include "wniApi.h"
 #include "sirApi.h"
 #include "aniGlobal.h"
@@ -51,17 +50,12 @@
 #include "wlan_qct_wdi_ds.h"
 #endif
 #include "wlan_qct_wda.h"
-
 #define LIM_POL_SYS_SCAN_MODE      0
 #define LIM_POL_SYS_LEARN_MODE     1
 
-
 /* Macro to count heartbeat */
-
 #define limResetHBPktCount(psessionEntry)   (psessionEntry->LimRxedBeaconCntDuringHB = 0)
 
-
-
 /* Useful macros for fetching various states in pMac->lim */
 /* gLimSystemRole */
 #define GET_LIM_SYSTEM_ROLE(psessionEntry)      (psessionEntry->limSystemRole)
@@ -80,9 +74,7 @@
 /* gLimQuietState */
 #define GET_LIM_QUIET_STATE(pMac)               (pMac->lim.gLimSpecMgmt.quietState)
 #define SET_LIM_QUIET_STATE(pMac, state)        (pMac->lim.gLimSpecMgmt.quietState = state)
-
 #define LIM_IS_CONNECTION_ACTIVE(psessionEntry)  (psessionEntry->LimRxedBeaconCntDuringHB)
-
 /*pMac->lim.gLimProcessDefdMsgs*/
 #define GET_LIM_PROCESS_DEFD_MESGS(pMac) (pMac->lim.gLimProcessDefdMsgs)
 #define SET_LIM_PROCESS_DEFD_MESGS(pMac, val) (pMac->lim.gLimProcessDefdMsgs = val)
@@ -94,7 +86,6 @@
 #define LIM_SET_RADAR_DETECTED(pMac, val)   (pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan = val)
 #define LIM_MIN_BCN_PR_LENGTH  12
 #define LIM_BCN_PR_CAPABILITY_OFFSET 10
-
 typedef enum eMgmtFrmDropReason
 {
     eMGMT_DROP_NO_DROP,
@@ -106,11 +97,8 @@
 }tMgmtFrmDropReason;
 
 
-
-
 /// During TD ring clean up at HDD in RTAI, will call this call back
 extern void limPostTdDummyPktCallbak(void* pMacGlobals, unsigned int* pBd);
-
 /**
  * Function to initialize LIM state machines.
  * This called upon LIM thread creation.
@@ -125,47 +113,32 @@
  * Function to Initialize radar interrupts.
  */
 void limRadarInit(tpAniSirGlobal pMac);
-
 tSirRetStatus peStart(tpAniSirGlobal pMac);
 void peStop(tpAniSirGlobal pMac);
 tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
 tSirRetStatus peProcessMsg(tpAniSirGlobal pMac, tSirMsgQ* limMsg);
 void limDumpInit(tpAniSirGlobal pMac);
-
 /**
  * Function to cleanup LIM state.
  * This called upon reset/persona change etc
  */
 extern void limCleanup(tpAniSirGlobal);
-
 /// Function to post messages to LIM thread
 extern tANI_U32  limPostMsgApi(tpAniSirGlobal, tSirMsgQ *);
-
 /**
  * Function to fetch messages posted LIM thread
  */
 extern void limProcessMessageQueue(tpAniSirGlobal);
-
 /**
  * Function to process messages posted to LIM thread
  * and dispatch to various sub modules within LIM module.
  */
 extern void limMessageProcessor(tpAniSirGlobal, tpSirMsgQ);
 extern void limProcessMessages(tpAniSirGlobal, tpSirMsgQ); // DT test alt deferred 2
-
-/**
- * Function to check the LIM state if system can be put in
- * Learn Mode.
- * This is called by SCH upon receiving SCH_START_LEARN_MODE
- * message from LIM.
- */
-extern tSirRetStatus limCheckStateForLearnMode(tpAniSirGlobal);
-
 /**
  * Function to check the LIM state if system is in Scan/Learn state.
  */
 extern tANI_U8 limIsSystemInScanState(tpAniSirGlobal);
-
 #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
 /**
  * Function to setup Polaris into Learn mode.
@@ -173,14 +146,11 @@
  * message from LIM.
  */
 extern void limSetLearnMode(tpAniSirGlobal);
-
 /**
  * Function to re-enable Learn mode measurements
  */
 extern void limReEnableLearnMode(tpAniSirGlobal);
-
 #endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
-
 /**
  * Function to handle IBSS coalescing.
  * Beacon Processing module to call this.
@@ -188,32 +158,23 @@
 extern tSirRetStatus limHandleIBSScoalescing(tpAniSirGlobal,
                                               tpSchBeaconStruct,
                                               tANI_U8 *,tpPESession);
-
 /// Function used by other Sirius modules to read global SME state
  static inline tLimSmeStates
 limGetSmeState(tpAniSirGlobal pMac) { return pMac->lim.gLimSmeState; }
-
 /// Function used by other Sirius modules to read global system role
  static inline tLimSystemRole
 limGetSystemRole(tpPESession psessionEntry) { return psessionEntry->limSystemRole; }
-
 //limGetAID(tpPESession psessionEntry) { return psessionEntry->limAID; }
-
 extern void limReceivedHBHandler(tpAniSirGlobal, tANI_U8, tpPESession);
 //extern void limResetHBPktCount(tpPESession);
-
 extern void limCheckAndQuietBSS(tpAniSirGlobal);
-
 /// Function to send WDS info to WSM if needed
 extern void limProcessWdsInfo(tpAniSirGlobal, tSirPropIEStruct);
-
 /// Function to initialize WDS info params
 extern void limInitWdsInfoParams(tpAniSirGlobal);
-
 /// Function that triggers STA context deletion
 extern void limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry);
 
-
 /// Function that checks for change in AP's capabilties on STA
 extern void limDetectChangeInApCapabilities(tpAniSirGlobal,
                                              tpSirProbeRespBeacon,tpPESession);
@@ -221,62 +182,46 @@
                                                             tpSirProbeRespBeacon pBeacon, 
                                                             tpUpdateBeaconParams pBeaconParams,tpPESession);
 
-
 /// creates an addts request action frame and sends it out to staid
 extern void limSendAddtsReq (tpAniSirGlobal pMac, tANI_U16 staid, tANI_U8 tsid, tANI_U8 userPrio, tANI_U8 wme);
 /// creates a delts request action frame and sends it out to staid
 extern void limSendDeltsReq (tpAniSirGlobal pMac, tANI_U16 staid, tANI_U8 tsid, tANI_U8 userPrio, tANI_U8 wme);
 /// creates a SM Power State Mode update request action frame and sends it out to staid
 extern void limPostStartLearnModeMsgToSch(tpAniSirGlobal pMac);
-
-extern ePhyChanBondState limGetPhyCBState( tpAniSirGlobal pMac );
-tSirMacHTSecondaryChannelOffset    limGetHTCBState(tAniCBSecondaryMode aniCBMode);
-tAniCBSecondaryMode     limGetAniCBState( tSirMacHTSecondaryChannelOffset htCBMode) ;
-
-
-
-
-
+#ifdef WLAN_FEATURE_11AC
+extern ePhyChanBondState limGet11ACPhyCBState(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 htSecondaryChannelOffset );
+#endif
 tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac);
-
 #if 0 /* Currently, this function is not used but keep it around for when we do need it */
 tSirRetStatus limUpdateGlobalChannelBonding(tpAniSirGlobal pMac, tHalBitVal cbBit);
 #endif /* 0 */
 
-
 #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
 extern void setupQuietBss( tpAniSirGlobal pMac, tANI_U32 learnInterval );
 extern tANI_BOOLEAN limUpdateQuietIEInBeacons( tpAniSirGlobal pMac );
 #endif
-
 #ifdef ANI_AP_SDK
 extern void limConvertScanDuration(tpAniSirGlobal pMac);
 #endif /* ANI_AP_SDK */
-
 #if (WNI_POLARIS_FW_PRODUCT == AP)
 tSirRetStatus limProcessCcaMonitorModeChangeNotification(tpAniSirGlobal pMac, tANI_U32 ccaCbMode);
 #endif /* WNI_POLARIS_FW_PRODUCT == AP */
-
 void limHandleLowRssiInd(tpAniSirGlobal pMac);
 void limHandleBmpsStatusInd(tpAniSirGlobal pMac);
 void limHandleMissedBeaconInd(tpAniSirGlobal pMac);
 tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType);
 void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
-
-
 /* ----------------------------------------------------------------------- */
 // These used to be in DPH
 extern void limSetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId);
 extern void limGetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId);
 extern void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac);
 extern tSirRetStatus limCheckRxSeqNumber(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo);
-
 #define limGetQosMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->limQosEnabled
 #define limGetWmeMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->limWmeEnabled
 #define limGetWsmMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->limWsmEnabled
 #define limGet11dMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->lim11dEnabled
 #define limGetAckPolicy(pMac, pVal)         *(pVal) = pMac->lim.ackPolicy
-
 /* ----------------------------------------------------------------------- */
 static inline void limGetPhyMode(tpAniSirGlobal pMac, tANI_U32 *phyMode, tpPESession psessionEntry)
 {
@@ -301,9 +246,7 @@
   \return  tANI_U32 - TX_SUCCESS for success.
   
   --------------------------------------------------------------------------*/
-
 tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
-
 /** -------------------------------------------------------------
 \fn peFreeMsg
 \brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
@@ -315,7 +258,5 @@
 \return none
 -----------------------------------------------------------------*/
 v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg);
-
 /************************************************************/
 #endif /* __LIM_API_H */
-
diff --git a/CORE/MAC/src/pe/include/limGlobal.h b/CORE/MAC/src/pe/include/limGlobal.h
index d35a6de..7061a68 100644
--- a/CORE/MAC/src/pe/include/limGlobal.h
+++ b/CORE/MAC/src/pe/include/limGlobal.h
@@ -363,6 +363,7 @@
 
 #ifdef WLAN_FEATURE_P2P
     tANI_BOOLEAN   p2pSearch;
+    tANI_BOOLEAN   skipDfsChnlInP2pSearch;
 #endif
     tANI_U16           uIEFieldLen;
     tANI_U16           uIEFieldOffset;
@@ -395,6 +396,27 @@
     tSirBssDescription bssDescription;
 };
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+
+#ifndef OEM_DATA_REQ_SIZE 
+#define OEM_DATA_REQ_SIZE 70
+#endif
+#ifndef OEM_DATA_RSP_SIZE
+#define OEM_DATA_RSP_SIZE 968
+#endif
+
+// OEM Data related structure definitions
+typedef struct sLimMlmOemDataReq
+{
+    tSirMacAddr           selfMacAddr;
+    tANI_U8               oemDataReq[OEM_DATA_REQ_SIZE];
+} tLimMlmOemDataReq, *tpLimMlmOemDataReq;
+
+typedef struct sLimMlmOemDataRsp
+{
+   tANI_U8                oemDataRsp[OEM_DATA_RSP_SIZE];
+} tLimMlmOemDataRsp, *tpLimMlmOemDataRsp;
+#endif
 
 // Pre-authentication structure definition
 typedef struct tLimPreAuthNode
@@ -438,6 +460,9 @@
     tANI_U8                 schClean:1;
     // 802.11n HT Capability in Station: Enabled 1 or DIsabled 0
     tANI_U8                 htCapability:1;
+#ifdef WLAN_FEATURE_11AC
+    tANI_U8                 vhtCapability:1;
+#endif
 } tLimMlmStaContext, *tpLimMlmStaContext;
 
 // Structure definition to hold deferred messages queue parameters
@@ -615,7 +640,7 @@
 {
     tLimChannelSwitchState   state;
     tANI_U8                  primaryChannel;
-    tAniCBSecondaryMode      secondarySubBand;
+    ePhyChanBondState        secondarySubBand;
     tANI_U32                 switchCount;
     tANI_U32                 switchTimeoutValue;
     tANI_U8                  switchMode;
diff --git a/CORE/MAC/src/pe/include/limSession.h b/CORE/MAC/src/pe/include/limSession.h
index 5f72af4..b98ac47 100644
--- a/CORE/MAC/src/pe/include/limSession.h
+++ b/CORE/MAC/src/pe/include/limSession.h
@@ -97,7 +97,16 @@
     void                    *pLimMlmReassocReq;      //handle to MLM reassoc Req
     tANI_U16                channelChangeReasonCode;
     tANI_U8                 dot11mode;
-    tANI_U8                 htCapabality;
+    tANI_U8                 htCapability;
+    /* Supported Channel Width Set: 0-20MHz 1 - 40MHz */
+    tANI_U8                 htSupportedChannelWidthSet;
+    /* Recommended Tx Width Set
+     * 0 - use 20 MHz channel (control channel)
+     * 1 - use channel width enabled under Supported Channel Width Set
+     */
+    tANI_U8                 htRecommendedTxWidthSet;
+    /* Identifies the 40 MHz extension channel */
+    ePhyChanBondState       htSecondaryChannelOffset;
     tSirRFBand              limRFBand;
     tANI_U8                 limIbssActive;          //TO SUPPORT CONCURRENCY
 
@@ -107,17 +116,19 @@
     tANI_U8                 limCurrentBssQosCaps;
     tANI_U16                limCurrentBssPropCap;
     tANI_U8                 limSentCapsChangeNtf;
-    tANI_U32                limCurrentTitanHtCaps;
     tANI_U16                limAID;
 
     /* Parameters  For Reassociation */
     tSirMacAddr             limReAssocbssId;
     tSirMacChanNum          limReassocChannelId;
+    /* CB paramaters required/duplicated for Reassoc since re-assoc mantains its own params in lim */
+    tANI_U8                 reAssocHtSupportedChannelWidthSet;
+    tANI_U8                 reAssocHtRecommendedTxWidthSet;
+    ePhyChanBondState       reAssocHtSecondaryChannelOffset;
     tSirMacSSid             limReassocSSID;
     tANI_U16                limReassocBssCaps;
     tANI_U8                 limReassocBssQosCaps;
     tANI_U16                limReassocBssPropCap;
-    tANI_U32                limReassocTitanHtCaps;
 
     // Assoc or ReAssoc Response Data/Frame
     void                   *limAssocResponseData;
@@ -288,12 +299,22 @@
     tANI_U8  gLimEdcaParamSetCount;
 
     tBeaconParams beaconParams;
-
+#ifdef WLAN_FEATURE_11AC
+    tANI_U8 vhtCapability;
+    tANI_U8 vhtTxChannelWidthSet;
+#endif
     tANI_U8            spectrumMgtEnabled;
+    /* *********************11H related*****************************/
+    //tANI_U32           gLim11hEnable;
+    tLimSpecMgmtInfo   gLimSpecMgmt;
+    // CB Primary/Secondary Channel Switch Info
+    tLimChannelSwitchInfo  gLimChannelSwitch;
+    /* *********************End 11H related*****************************/
 
     /*Flag to Track Status/Indicate HBFailure on this session */
     tANI_BOOLEAN LimHBFailureStatus;
     tANI_U32           gLimPhyMode;
+
 }tPESession, *tpPESession;
 
 #define LIM_MAX_ACTIVE_SESSIONS 4
diff --git a/CORE/MAC/src/pe/include/limTrace.h b/CORE/MAC/src/pe/include/limTrace.h
index f0c2a1b..062ddb3 100644
--- a/CORE/MAC/src/pe/include/limTrace.h
+++ b/CORE/MAC/src/pe/include/limTrace.h
@@ -107,6 +107,7 @@
 
 
 #define MTRACE(p) p
+#define NO_SESSION 0xFF
 
 #else
 #define MTRACE(p) {  }
diff --git a/CORE/MAC/src/pe/lim/limAdmitControl.c b/CORE/MAC/src/pe/lim/limAdmitControl.c
index d14e56a..ec69451 100644
--- a/CORE/MAC/src/pe/lim/limAdmitControl.c
+++ b/CORE/MAC/src/pe/lim/limAdmitControl.c
@@ -1099,7 +1099,7 @@
      * WDA_ADD_TS_RSP from HAL.
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+    MTRACE(macTraceMsgTx(pMac, sessionId, msg.type));
 
     if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
     {
@@ -1126,7 +1126,8 @@
   tpAniSirGlobal pMac,
   tANI_U16       staIdx,
   tANI_U8         tspecIdx,
-  tSirDeltsReqInfo delts)
+  tSirDeltsReqInfo delts,
+  tANI_U8        sessionId)
 {
   tSirMsgQ msg;
   tpDelTsParams pDelTsParam;
@@ -1147,7 +1148,7 @@
   pDelTsParam->tspecIdx = tspecIdx;
 
   PELOGW(limLog(pMac, LOGW, FL("calling wdaPostCtrlMsg()\n"));)
-  MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+  MTRACE(macTraceMsgTx(pMac, sessionId, msg.type));
 
   if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
   {
diff --git a/CORE/MAC/src/pe/lim/limApi.c b/CORE/MAC/src/pe/lim/limApi.c
index 7b4fac0..aac103b 100644
--- a/CORE/MAC/src/pe/lim/limApi.c
+++ b/CORE/MAC/src/pe/lim/limApi.c
@@ -235,7 +235,7 @@
     pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
 
     /// MLM State visible across all Sirius modules
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_IDLE_STATE));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
     pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
 
     /// Previous MLM State
@@ -248,15 +248,15 @@
 
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
     /**
-     * Initialize state to eLIM_MLM_OFFLINE_STATE
+     * Initialize state to eLIM_SME_OFFLINE_STATE
      */
-    pMac->lim.gLimSmeState     = eLIM_MLM_OFFLINE_STATE;
+    pMac->lim.gLimSmeState     = eLIM_SME_OFFLINE_STATE;
 #else
     /**
      * Initialize state to suspended state and wait for
      * HAL to send LIM_RESUME_ACTIVITY_NTF message.
      */
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
     pMac->lim.gLimSmeState     = eLIM_SME_SUSPEND_STATE;
 #endif /* FEATURE_WLAN_INTEGRATED_SOC */
 
@@ -275,7 +275,6 @@
     pMac->lim.gLimPhyMode = 0; 
     pMac->lim.scanStartTime = 0;    // used to measure scan time
 
-    palZeroMemory(pMac->hHdd, pMac->lim.gLimBssid, sizeof(pMac->lim.gLimBssid));
     palZeroMemory(pMac->hHdd, pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr));
     pMac->lim.ackPolicy = 0;
 
@@ -325,20 +324,11 @@
     palZeroMemory(pMac->hHdd, &pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo));
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
 
+#if 0
     // 11h Spectrum Management Related Flag
-    //pMac->lim.gLim11hEnable = 0;
-    pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
     LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
     pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
-
-    // 11h Quiet Element Related Flag
-    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
-    // A count-down value, used on the AP, to send out the
-    // Quiet BSS IE in that many Beacon's
-    pMac->lim.gLimSpecMgmt.quietCount = 0;
-    pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_FALSE;
-    pMac->lim.gLimSpecMgmt.fRadarIntrConfigured = eANI_BOOLEAN_FALSE;
-
+#endif
     // WMM Related Flag
     pMac->lim.gUapsdEnable = 0;
     pMac->lim.gUapsdPerAcBitmask = 0;
@@ -376,7 +366,7 @@
     // Place holder for current authentication request
     // being handled
     pMac->lim.gpLimMlmAuthReq = NULL;
-    pMac->lim.gpLimMlmJoinReq = NULL;
+    //pMac->lim.gpLimMlmJoinReq = NULL;
 
     /// MAC level Pre-authentication related globals
     pMac->lim.gLimPreAuthChannelNumber = 0;
@@ -399,32 +389,20 @@
     palZeroMemory(pMac->hHdd, pMac->lim.protStaOverlapCache, sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE);
     palZeroMemory(pMac->hHdd, pMac->lim.protStaCache, sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE);
 
-    // Initialize Assoc/ReAssoc Response Data/Frame
-    //pMac->lim.gLimAssocResponseData = NULL;
-
 }
 
 
 static void __limInitTitanVars(tpAniSirGlobal pMac)
 {
-    pMac->lim.gCbMode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
-    SET_CB_STATE_DISABLE( pMac->lim.gCbState );
+#if 0
     palZeroMemory(pMac->hHdd, &pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo));
-
     pMac->lim.gLimChannelSwitch.state               = eLIM_CHANNEL_SWITCH_IDLE;
-    pMac->lim.gLimChannelSwitch.secondarySubBand    = eANI_CB_SECONDARY_NONE;
-
+    pMac->lim.gLimChannelSwitch.secondarySubBand    = PHY_SINGLE_CHANNEL_CENTERED;
+#endif
     // Debug workaround for BEACON's
     // State change triggered by "dump 222"
     pMac->lim.gLimScanOverride = 1;
     pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
-
-
-    // Caches the CB State as desired by SME
-    SET_CB_STATE_DISABLE( pMac->lim.gCbStateProtected );
-
-    // TODO - This needs to be read off of a CFG variable
-
     pMac->lim.gLimTitanStaCount = 0;
     pMac->lim.gLimBlockNonTitanSta = 0;
 }
@@ -432,9 +410,7 @@
 static void __limInitHTVars(tpAniSirGlobal pMac)
 {
     pMac->lim.htCapabilityPresentInBeacon = 0;
-    pMac->lim.htCapability = 0;
     pMac->lim.gHTGreenfield = 0;
-    pMac->lim.gHTSupportedChannelWidthSet = 0;
     pMac->lim.gHTShortGI40Mhz = 0;
     pMac->lim.gHTShortGI20Mhz = 0;
     pMac->lim.gHTMaxAmsduLength = 0;
@@ -448,8 +424,6 @@
     pMac->lim.gHTMaxRxAMpduFactor = 0;
     pMac->lim.gHTServiceIntervalGranularity = 0;
     pMac->lim.gHTControlledAccessOnly = 0;
-    pMac->lim.gHTRecommendedTxWidthSet = 0;
-    pMac->lim.gHTSecondaryChannelOffset = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
     pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
     pMac->lim.gHTPCOActive = 0;
 
@@ -463,7 +437,7 @@
 #if defined( FEATURE_WLAN_INTEGRATED_SOC )
 static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
 {
-   tANI_U32 val1, val2, val3, len;
+   tANI_U32 val1, val2, val3;
    tANI_U16 val16;
    tANI_U8 val8;
    tSirMacHTCapabilityInfo   *pHTCapabilityInfo;
@@ -472,14 +446,10 @@
    tSirMacHTParametersInfo   *pAmpduParamInfo;
 
    /* Read all the CFGs here that were updated before peStart is called */
+   /* All these CFG READS/WRITES are only allowed in init, at start when there is no session 
+    * and they will be used throughout when there is no session
+    */
 
-   /* WNI_CFG_CHANNEL_BONDING_MODE */
-
-   handleCBCFGChange( pMac, WNI_CFG_CHANNEL_BONDING_MODE );
-         
-   //for Secondary channel, change setupCBMode function OR the caller of that
-   //function during Join (STA) or Start BSS(AP/IBSS) Now update the HT Capability
-   //CFG based on Channel Bonding CFG
    if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS) 
    {
       PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
@@ -515,7 +485,6 @@
    pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
    pHTInfoField1->recommendedTxWidthSet = 
      (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
-   pMac->lim.gHTRecommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
    if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1) 
       != eSIR_SUCCESS)
    {
@@ -602,16 +571,6 @@
       return eSIR_FAILURE;
    }
 
-   /* WNI_CFG_BSSID - this one is not updated in limHandleCFGparamUpdate do we
-      want to update this? */
-   len = 6;
-   if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, pMac->lim.gLimBssid, &len) != 
-       eSIR_SUCCESS)
-   {
-      limLog(pMac, LOGP, FL("cfg get bssid failed\n"));
-      return eSIR_FAILURE;
-   }
-
    /* WNI_CFG_MAX_PS_POLL */
 
    /* Allocate and fill in power save configuration. */
@@ -649,8 +608,7 @@
 
    /* This was initially done after resume notification from HAL. Now, DAL is
       started before PE so this can be done here */
-   handleCBCFGChange( pMac, ANI_IGNORE_CFG_ID );
-   handleHTCapabilityandHTInfo(pMac);
+   handleHTCapabilityandHTInfo(pMac, NULL);
 
    return eSIR_SUCCESS;
 }
@@ -671,7 +629,7 @@
    {
       pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
 
-      MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+      MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
 
       // By default do not return after first scan match
       pMac->lim.gLimReturnAfterFirstMatch = 0;
@@ -910,11 +868,13 @@
         pMac->lim.gpLimMlmAuthReq = NULL;
     }
 
+#if 0
     if (pMac->lim.gpLimMlmJoinReq != NULL)
     {
         palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
         pMac->lim.gpLimMlmJoinReq = NULL;
     }
+#endif
 
     #if 0
     if (pMac->lim.gpLimReassocReq != NULL)
@@ -1074,6 +1034,9 @@
     }
 #endif
 
+#ifdef WLAN_FEATURE_P2P
+    pMac->lim.actionFrameSessionId = 0xff;
+#endif
 
     return eSIR_SUCCESS;
 }
@@ -1091,13 +1054,7 @@
 
     if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
         return eSIR_SUCCESS;
-
-    palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
-    pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
-    palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
-    pMac->lim.gpLimAIDpool = NULL;
-
-   
+    
     for(i =0; i < pMac->lim.maxBssId; i++)
     {
         if(pMac->lim.gpSession[i].valid == TRUE)
@@ -1105,7 +1062,11 @@
             peDeleteSession(pMac,&pMac->lim.gpSession[i]);
         }
     }
-
+    palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
+    pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
+    palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
+    pMac->lim.gpLimAIDpool = NULL;
+    
     palFreeMemory(pMac->hHdd, pMac->lim.gpSession);
     pMac->lim.gpSession = NULL;
     /*
@@ -1436,9 +1397,9 @@
     {
     PELOG1(limLog( pMac, LOG1,
        FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d  Sizes:FC%d Mgmt%d\n"),
-       pRxBd, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
+       pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
 
-    MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, 0, 
+    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)));)
     }
@@ -1496,49 +1457,6 @@
 
 
 /**
- * limCheckStateForLearnMode()
- *
- *FUNCTION:
- * This function is called by SCH to verify if LIM is in a state
- * to put system into Learn mode
- *
- *LOGIC:
- * NA
- *
- *ASSUMPTIONS:
- * NA
- *
- *NOTE:
- *
- * @param  pMac - Pointer to Global MAC structure
- * @return eSIR_SUCCESS - LIM is in a state to put system
- *                        into Learn Mode
- *         eSIR_FAILURE - LIM is NOT in a state to put system
- *                        into Learn Mode
- */
-
-tSirRetStatus
-limCheckStateForLearnMode(tpAniSirGlobal pMac)
-{
-    switch (pMac->lim.gLimSmeState)
-    {
-        case eLIM_SME_OFFLINE_STATE:
-        case eLIM_SME_IDLE_STATE:
-        case eLIM_SME_JOIN_FAILURE_STATE:
-        case eLIM_SME_NORMAL_STATE:
-        case eLIM_SME_LINK_EST_STATE:
-            // LIM is in a state to put system into Learn mode
-            return eSIR_SUCCESS;
-
-        default:
-            // LIM is NOT in a state to put system into Learn mode
-            return eSIR_FAILURE;
-    }
-} /*** end limCheckStateForLearnMode() ***/
-
-
-
-/**
  * limIsSystemInScanState()
  *
  *FUNCTION:
@@ -1738,7 +1656,7 @@
     pMac->lim.gLimMeasParams.shortDurationCount++;
     limDeactivateAndChangeTimer(pMac, eLIM_LEARN_DURATION_TIMER);
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_LEARN_DURATION_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_LEARN_DURATION_TIMER));
     if (tx_timer_activate(&pMac->lim.gLimMeasParams.learnDurationTimer)
                                            != TX_SUCCESS)
     {
@@ -1786,7 +1704,7 @@
 
     if (pMac->lim.gLimSpecMgmt.fQuietEnabled)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_QUIET_BSS_TIMER));
 #ifdef GEN6_TODO
         /* revisit this piece of code to assign the appropriate sessionId below
          * priority - HIGH
@@ -1805,7 +1723,7 @@
     else
     {
         limDeactivateAndChangeTimer(pMac, eLIM_LEARN_INTERVAL_TIMER);
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_LEARN_INTERVAL_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_LEARN_INTERVAL_TIMER));
 #ifdef GEN6_TODO
         /* revisit this piece of code to assign the appropriate sessionId below
         */
@@ -1960,7 +1878,7 @@
                 mmhMsg.type = eWNI_SME_WDS_INFO_IND;
                 mmhMsg.bodyptr = pSirSmeWdsInfoInd;
                 mmhMsg.bodyval = 0;
-                MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+                MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
                 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
                 pMac->lim.gLimNumWdsInfoInd++;
             }
@@ -2227,12 +2145,27 @@
 {
 
     tSirSmeApNewCaps   apNewCaps;
-    tANI_U32                cShortSlot, nShortSlot;
- 
-    apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
+    tANI_U32           nShortSlot;
+    tANI_U32 val = 0;
+    tANI_U32 phyMode;
 
-    if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &cShortSlot) != eSIR_SUCCESS)
-        limLog(pMac, LOGP, FL("unable to get short slot time\n"));
+    // Check Admin mode first. If it is disabled just return
+    if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
+                   != eSIR_SUCCESS)
+    {
+        limLog(pMac, LOGP,
+               FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed\n"));
+        return eSIR_FAILURE;
+    }
+    if (val == false)
+        return eSIR_SUCCESS;
+
+    // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
+    limGetPhyMode(pMac, &phyMode, psessionEntry);
+    if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
+        return eSIR_SUCCESS;
+
+    apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
 
     //  Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
     // when erp is present, apply short slot always unless, prot=on  && shortSlot=off
@@ -2255,16 +2188,14 @@
     */
     nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
 
-    if (nShortSlot != cShortSlot)
+    if (nShortSlot != psessionEntry->shortSlotTimeSupported)
     {
         // Short slot time capability of AP has changed. Adopt to it.
         PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d\n"),  nShortSlot);)
         ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
+        psessionEntry->shortSlotTimeSupported = nShortSlot;
         pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
         pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
-
-        if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, nShortSlot) != eSIR_SUCCESS)
-            PELOGE(limLog(pMac, LOGE,  FL("could not update short slot time at CFG\n"));)
     }
     return eSIR_SUCCESS;
 }
@@ -2447,7 +2378,7 @@
     msg.type = WDA_INIT_RADAR_IND;
     msg.bodyptr = NULL;
     msg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
     status = wdaPostCtrlMsg(pMac, &msg);
     if (status != eHAL_STATUS_SUCCESS)
     {
diff --git a/CORE/MAC/src/pe/lim/limAssocUtils.c b/CORE/MAC/src/pe/lim/limAssocUtils.c
index 9402dda..60a1591 100644
--- a/CORE/MAC/src/pe/lim/limAssocUtils.c
+++ b/CORE/MAC/src/pe/lim/limAssocUtils.c
@@ -609,7 +609,7 @@
 
     if (pMac->lim.gLimAddtsSent)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_ADDTS_RSP_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
         tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
     }
 
@@ -654,9 +654,9 @@
 
     if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
         psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
         /* Deactivating probe after heart beat timer */
         limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
         limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
@@ -843,8 +843,23 @@
         smetransactionId = psessionEntry->transactionId;
 
         psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
 
+        //if it is a reassoc failure to join new AP
+        if(mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE)
+        {
+            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
+        {
         palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
         psessionEntry->pLimJoinReq = NULL;
 
@@ -856,6 +871,7 @@
         
         limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
                                  psessionEntry, smesessionId, smetransactionId);
+        }
         
     } 
 
@@ -1050,7 +1066,7 @@
     if(SIR_BAND_5_GHZ == rfBand)
     {
         //we are HT. if we are 11A, then protection is not required.
-        if(true == psessionEntry->htCapabality)
+        if(true == psessionEntry->htCapability)
         {
             //we are HT and 11A station is leaving.
             //protection consideration required.
@@ -1093,7 +1109,7 @@
         erpEnabled = pStaDs->erpEnabled;
         //we are HT or 11G and 11B station is getting deleted.
         if (((phyMode == WNI_CFG_PHY_MODE_11G) ||
-              psessionEntry->htCapabality) &&
+              psessionEntry->htCapability) &&
               (erpEnabled == eHAL_CLEAR))
         {
             PELOG1(limLog(pMac, LOG1, FL("(%d) A legacy STA is disassociated. Addr is "),
@@ -1124,7 +1140,7 @@
             }
         }
         //(non-11B station is leaving) or (we are not 11G or HT AP)
-        else if(psessionEntry->htCapabality)
+        else if(psessionEntry->htCapability)
         { //we are HT AP and non-11B station is leaving.
 
             //11g station is leaving            
@@ -1160,7 +1176,7 @@
     }
 
     //LSIG TXOP not supporting staiton leaving. applies to 2.4 as well as 5 GHZ.
-    if((true == psessionEntry->htCapabality) &&
+    if((true == psessionEntry->htCapability) &&
         (true == pStaDs->mlmStaContext.htCapability))
     {
         //HT non-GF leaving
@@ -1318,7 +1334,7 @@
              }
           }
        }
-       else 
+       else
 #endif
        {
            if (pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta> 0)
@@ -1354,9 +1370,7 @@
          {
             pBeaconParams->fShortSlotTime = true;
             pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
-
-            if (cfgSetInt(pMac,  WNI_CFG_SHORT_SLOT_TIME,  true) != eSIR_SUCCESS)
-                PELOGE(limLog(pMac, LOGE,  FL("could not update short slot time at CFG\n"));)
+            psessionEntry->shortSlotTimeSupported = true;
          }
       }
       else 
@@ -1373,10 +1387,8 @@
             {
                pBeaconParams->fShortSlotTime = true;
                pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
-
-               if (cfgSetInt(pMac,  WNI_CFG_SHORT_SLOT_TIME,  true) != eSIR_SUCCESS)
-                     PELOGE(limLog(pMac, LOGE,  FL("could not update short slot time at CFG\n"));)
-             }
+               psessionEntry->shortSlotTimeSupported = true;
+            }
           }
        }
    }
@@ -1409,12 +1421,11 @@
                           tSirResultCodes resultCode,
                           tANI_U16 protStatusCode,tpPESession psessionEntry)
 {
-    tANI_U8                  chanNum;
+    tANI_U8             chanNum, secChanOffset;
     tLimMlmReassocCnf   mlmReassocCnf;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_LINK_ESTABLISHED_STATE));
     psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_LINK_ESTABLISHED_STATE));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
 
     // 'Change' timer for future activations
     limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
@@ -1435,8 +1446,9 @@
 
    /*  To support BT-AMP */
    chanNum = psessionEntry->currentOperChannel;
+   secChanOffset = psessionEntry->htSecondaryChannelOffset;
 
-    limSetChannel(pMac, psessionEntry->limCurrentTitanHtCaps, chanNum, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+    limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
 
     /** @ToDo : Need to Integrate the STOP the DataTransfer to the AP from 11H code */
 
@@ -1480,7 +1492,71 @@
     return eANI_BOOLEAN_FALSE;
 } /*** end limIsReassocInProgress() ***/
 
+#ifdef WLAN_FEATURE_11AC
+tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac,
+                                  tpSirSupportedRates pRates,
+                                  tDot11fIEVHTCaps *pPeerVHTCaps,
+                                  tpPESession psessionEntry)
+{
+    tANI_U32 val;
 
+    if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
+    {
+        if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_MCS_MAP,&val) != 
+            eSIR_SUCCESS )
+        {
+            PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX MCS MAP\n"));)
+            goto error;
+        }
+        pRates->vhtRxMCSMap = (tANI_U16)val;
+    
+        if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_MCS_MAP,&val ) != 
+            eSIR_SUCCESS )
+        {
+            PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT TX MCS MAP\n"));)
+            goto error;
+        }
+        pRates->vhtTxMCSMap = (tANI_U16)val;
+
+        if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,&val ) != 
+            eSIR_SUCCESS )
+        {
+            PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP\n"));)
+            goto error;
+        }
+        pRates->vhtRxHighestDataRate = (tANI_U16)val;
+    
+        if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,&val ) != 
+            eSIR_SUCCESS )
+        {
+            PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP\n"));)
+            goto error;
+        }
+        pRates->vhtTxHighestDataRate = (tANI_U16)val;
+
+        if( pPeerVHTCaps != NULL)
+        {
+            pRates->vhtTxHighestDataRate = SIR_MIN(pRates->vhtTxHighestDataRate, pPeerVHTCaps->txSupDataRate);
+            pRates->vhtRxHighestDataRate = SIR_MIN(pRates->vhtRxHighestDataRate, pPeerVHTCaps->rxHighSupDataRate);
+
+            // Aquire PEER MCS map if we exceed.
+            // We compare/update only the last 2 bits of the map as we support only single BSS.
+            // Firmware takes care of this comparison
+            pRates->vhtRxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
+            pRates->vhtRxMCSMap |= (pPeerVHTCaps->rxMCSMap & 0x3); // Updating the last 2 bits in the bitmap
+
+            // Firmware takes care of this comparison
+            pRates->vhtTxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
+            pRates->vhtTxMCSMap |= (pPeerVHTCaps->txMCSMap & 0x3); // Updating the last 2 bits in the bitmap
+        }
+    }
+    return eSIR_SUCCESS;
+error:
+
+    return eSIR_FAILURE;
+
+}
+#endif
 
 /**
  * limPopulateOwnRateSet
@@ -1505,13 +1581,23 @@
  * @return eSIR_SUCCESS or eSIR_FAILURE
  *
  */
-
+#ifdef WLAN_FEATURE_11AC
+tSirRetStatus
+limPopulateOwnRateSet(tpAniSirGlobal pMac,
+                      tpSirSupportedRates pRates,
+                      tANI_U8* pSupportedMCSSet,
+                      tANI_U8 basicOnly,
+                      tpPESession psessionEntry,
+                      tDot11fIEVHTCaps *pVHTCaps)
+#else
 tSirRetStatus
 limPopulateOwnRateSet(tpAniSirGlobal pMac,
                       tpSirSupportedRates pRates,
                       tANI_U8* pSupportedMCSSet,
                       tANI_U8 basicOnly,
                       tpPESession psessionEntry)
+#endif
+
 {
     tSirMacRateSet          tempRateSet;
     tSirMacRateSet          tempRateSet2;
@@ -1659,8 +1745,9 @@
             PELOGW(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
     }
 
-
-
+#ifdef WLAN_FEATURE_11AC
+    limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
+#endif
 
     return eSIR_SUCCESS;
 
@@ -1669,8 +1756,6 @@
     return eSIR_FAILURE;
 } /*** limPopulateOwnRateSet() ***/
 
-
-
 /**
  * limPopulateMatchingRateSet
  * FUNCTION:
@@ -1700,7 +1785,18 @@
  *
  * @return:  eSIR_SUCCESS or eSIR_FAILURE
  */
+#ifdef WLAN_FEATURE_11AC
+tSirRetStatus
+limPopulateMatchingRateSet(tpAniSirGlobal pMac,
+                           tpDphHashNode pStaDs,
+                           tSirMacRateSet *pOperRateSet,
+                           tSirMacRateSet *pExtRateSet,
+                           tANI_U8* pSupportedMCSSet,
+                           tSirMacPropRateSet *pAniLegRateSet,
+                           tpPESession  psessionEntry,
+                           tDot11fIEVHTCaps *pVHTCaps)
 
+#else
 tSirRetStatus
 limPopulateMatchingRateSet(tpAniSirGlobal pMac,
                            tpDphHashNode pStaDs,
@@ -1709,6 +1805,7 @@
                            tANI_U8* pSupportedMCSSet,
                            tSirMacPropRateSet *pAniLegRateSet,
                            tpPESession  psessionEntry)
+#endif
 {
    tSirMacRateSet          tempRateSet;
    tSirMacRateSet          tempRateSet2;
@@ -1929,6 +2026,9 @@
         }
     }
 
+#ifdef WLAN_FEATURE_11AC
+    limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry);
+#endif
     /**
       * Set the erpEnabled bit iff the phy is in G mode and at least
       * one A rate is supported
@@ -2041,9 +2141,20 @@
     //Update HT Capability
 
     if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||(limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) || (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE))
+    {
         pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
+#ifdef WLAN_FEATURE_11AC
+        pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
+#endif
+    }
     else
-          pAddStaParams->htCapable = psessionEntry->htCapabality;
+    {
+        pAddStaParams->htCapable = psessionEntry->htCapability;
+#ifdef WLAN_FEATURE_11AC
+        pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
+#endif
+
+    }
 
     pAddStaParams->greenFieldCapable = pStaDs->htGreenfield;
     pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity;
@@ -2055,6 +2166,18 @@
     pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength;
     pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
     pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
+
+#ifdef WLAN_FEATURE_11AC
+    if(pAddStaParams->vhtCapable)
+    {
+        pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
+
+        /* TODO. Need to discuss this. Overwriting here.
+         * Stick to SAP's configuration for HT supported Channel width */
+        pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
+    }
+#endif
+
     /* Update PE session ID*/
     pAddStaParams->sessionId = psessionEntry->peSessionId;
 
@@ -2102,7 +2225,8 @@
   //we need to defer the message until we get the response back from HAL.
     if (pAddStaParams->respReqd)
         SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-  msgQ.type = WDA_ADD_STA_REQ;
+
+    msgQ.type = WDA_ADD_STA_REQ;
 
     msgQ.reserved = 0;
     msgQ.bodyptr = pAddStaParams;
@@ -2110,11 +2234,13 @@
 
     limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d\n" ),
             pStaDs->assocId);
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode)
     {
+       if (pAddStaParams->respReqd)
+          SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
         limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)\n"),
                             pStaDs->assocId, retCode );
         palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
@@ -2201,13 +2327,13 @@
         //when limDelSta is called from processSmeAssocCnf then mlmState is already set properly.
         if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs))
         {
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
             SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, eLIM_MLM_WT_DEL_STA_RSP_STATE);
         }
         if ( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) || 
              (eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
         {
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
 
             psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; 
     
@@ -2228,10 +2354,12 @@
 
     limLog( pMac, LOGE, FL( "Sending SIR_HAL_DELETE_STA_REQ for STAID: %X and AssocID: %d\n" ),
     pDelStaParams->staIdx, pDelStaParams->assocId);
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode)
     {
+        if(fRespReqd)
+           SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
         limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X\n"),
                         retCode );
         palFreeMemory(pMac->hHdd, (void*)pDelStaParams);
@@ -2272,7 +2400,7 @@
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
     limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId);
 #endif
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
     psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
     psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
@@ -2358,11 +2486,15 @@
     pAddStaParams->updateSta = updateSta;
 
     pAddStaParams->shortPreambleSupported = psessionEntry->beaconParams.fShortPreamble;
-    limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
 
-    if( psessionEntry->htCapabality)
+#ifdef WLAN_FEATURE_11AC
+    limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL);
+#else
+    limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
+#endif
+    if( psessionEntry->htCapability)
     {
-        pAddStaParams->htCapable = psessionEntry->htCapabality;
+        pAddStaParams->htCapable = psessionEntry->htCapability;
 #ifdef DISABLE_GF_FOR_INTEROP
         /*
          * To resolve the interop problem with Broadcom AP, 
@@ -2406,7 +2538,10 @@
         pAddStaParams->fShortGI40Mhz     = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
 #endif
     }
-
+#ifdef WLAN_FEATURE_11AC
+    pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
+    pAddStaParams->vhtTxChannelWidthSet = pMac->lim.apChanWidth;
+#endif
     if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
        limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
     pAddStaParams->listenInterval = (tANI_U16)listenInterval;
@@ -2432,7 +2567,7 @@
 
     limLog( pMac, LOGW, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ),
           pAddStaParams->assocId);
-  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
@@ -2688,7 +2823,7 @@
         if ( pBPR->HTInfo.present )
             limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry);
         psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_JOINED_STATE));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
 
 #if (WNI_POLARIS_FW_PRODUCT == AP)
         // In case of BP, we need to adopt to all rates
@@ -2811,7 +2946,7 @@
     else
         pDelBssParams->bssIdx          = bssIdx;
     psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
 
     pDelBssParams->status= eHAL_STATUS_SUCCESS;
     pDelBssParams->respReqd = 1;
@@ -2826,10 +2961,11 @@
     msgQ.bodyptr = pDelBssParams;
     msgQ.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
+        SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
         limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X\n"), retCode );
         palFreeMemory(pMac->hHdd, (void*)pDelBssParams);
     }
@@ -2929,7 +3065,7 @@
 
     pAddBssParams->nwType = bssDescription->nwType;
     
-    pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;    
+    pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
     pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;    
     pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
     pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
@@ -2961,7 +3097,7 @@
             else
             {
                 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
-                pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+                pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
             }
             pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
             pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
@@ -2971,6 +3107,22 @@
 
     pAddBssParams->currentOperChannel = bssDescription->channelId;
 
+#ifdef WLAN_FEATURE_11AC
+    if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present ))
+    {
+        pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present;
+        pAddBssParams->vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; 
+        pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac, 
+                                           pAddBssParams->currentOperChannel,
+                                           pAddBssParams->currentExtChannel );
+    }
+    else 
+    {
+        pAddBssParams->vhtCapable = 0;
+    }
+#endif
+
+
     // Populate the STA-related parameters here
     // Note that the STA here refers to the AP
     {
@@ -3012,6 +3164,14 @@
                 (chanWidthSupp) )
             {
                 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
+                
+#ifdef WLAN_FEATURE_11AC
+                if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
+                {
+                    pAddBssParams->staContext.vhtCapable = 1;
+                    pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth;
+                }
+#endif
             }
             else
             {
@@ -3078,7 +3238,8 @@
     }
 #endif
 
-    pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
+    pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled || 
+        limIsconnectedOnDFSChannel(bssDescription->channelId);
 
 #if defined WLAN_FEATURE_VOWIFI_11R
     pAddBssParams->extSetStaKeyParamValid = 0;
@@ -3089,7 +3250,7 @@
         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, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
     //we need to defer the message until we get the response back from HAL.
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
@@ -3101,11 +3262,12 @@
     msgQ.bodyval = 0;
 
     limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode) 
     {
+        SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
         palFreeMemory(pMac->hHdd, pAddBssParams);
         limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
                 retCode );
@@ -3189,7 +3351,7 @@
 
     pAddBssParams->nwType = bssDescription->nwType;
     
-    pAddBssParams->shortSlotTimeSupported = (tANI_U8)beaconStruct.capabilityInfo.shortSlotTime; 
+    pAddBssParams->shortSlotTimeSupported = (tANI_U8)beaconStruct.capabilityInfo.shortSlotTime;
     pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
     pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
     pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
@@ -3219,7 +3381,7 @@
             else
             {
                 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
-                pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+                pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
             }
             pAddBssParams->llnNonGFCoexist = (tANI_U8)beaconStruct.HTInfo.nonGFDevicesPresent;
             pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)beaconStruct.HTInfo.lsigTXOPProtectionFullSupport;
@@ -3229,6 +3391,21 @@
 
     pAddBssParams->currentOperChannel = bssDescription->channelId;
 
+#ifdef WLAN_FEATURE_11AC
+    if (psessionEntry->vhtCapability && ( beaconStruct.VHTCaps.present ))
+    {
+        pAddBssParams->vhtCapable = beaconStruct.VHTCaps.present;
+        pAddBssParams->vhtTxChannelWidthSet = beaconStruct.VHTOperation.chanWidth; 
+        pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac, 
+                                           pAddBssParams->currentOperChannel,
+                                           pAddBssParams->currentExtChannel );
+    }
+    else 
+    {
+        pAddBssParams->vhtCapable = 0;
+    }
+#endif
+
     // Populate the STA-related parameters here
     // Note that the STA here refers to the AP
     {
@@ -3255,6 +3432,13 @@
                 (chanWidthSupp) )
             {
                 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )beaconStruct.HTInfo.recommendedTxWidthSet;
+          #ifdef WLAN_FEATURE_11AC
+                if (psessionEntry->vhtCapability && ( beaconStruct.VHTCaps.present ))
+                {
+                    pAddBssParams->staContext.vhtCapable = 1;
+                    pAddBssParams->staContext.vhtTxChannelWidthSet = beaconStruct.VHTOperation.chanWidth; 
+                }
+          #endif
             }
             else
             {
@@ -3280,9 +3464,14 @@
             pAddBssParams->staContext.wmmEnabled = 0;
 
         //Update the rates
-        
+#ifdef WLAN_FEATURE_11AC
         limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates, 
-                                                    beaconStruct.HTCaps.supportedMCSSet, false,psessionEntry);
+                                        beaconStruct.HTCaps.supportedMCSSet, false,psessionEntry,
+                                        &beaconStruct.VHTCaps);
+#else
+        limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates, 
+                                        beaconStruct.HTCaps.supportedMCSSet, false,psessionEntry);
+#endif
         limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry);
 
     }
@@ -3311,7 +3500,8 @@
     
     pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
 
-    pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
+    pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled || 
+        limIsconnectedOnDFSChannel(bssDescription->channelId);
 
 #if defined WLAN_FEATURE_VOWIFI_11R
     pAddBssParams->extSetStaKeyParamValid = 0;
@@ -3322,7 +3512,7 @@
     //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
     psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
     
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
     //we need to defer the message until we get the response back from HAL.
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
@@ -3334,11 +3524,12 @@
     msgQ.bodyval = 0;
 
     limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode) 
     {
+        SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
         palFreeMemory(pMac->hHdd, pAddBssParams);
         limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
                 retCode );
@@ -3439,7 +3630,7 @@
             else
             {
                 pAddBssParams->txChannelWidthSet = (tANI_U8)pAssocRsp->HTCaps.supportedChannelWidthSet;
-                pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+                pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
             }
             pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
             pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
@@ -3536,7 +3727,7 @@
         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, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
     //we need to defer the message until we get the response back from HAL.
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
@@ -3548,7 +3739,7 @@
     msgQ.bodyval = 0;
 
     limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
     retCode = halPostMsgApi( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode) 
@@ -3609,7 +3800,7 @@
     if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
     {
         psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
     }
 
     limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry);
@@ -3633,6 +3824,10 @@
                 return eSTA_11bg;
             case WNI_CFG_DOT11_MODE_11N:
                 return eSTA_11n;
+#ifdef WLAN_FEATURE_11AC
+            case WNI_CFG_DOT11_MODE_11AC:
+                return eSTA_11ac;
+#endif
             case WNI_CFG_DOT11_MODE_ALL:
             default:
                 return eSTA_11n;           
diff --git a/CORE/MAC/src/pe/lim/limAssocUtils.h b/CORE/MAC/src/pe/lim/limAssocUtils.h
index a46f7ab..8b123fe 100644
--- a/CORE/MAC/src/pe/lim/limAssocUtils.h
+++ b/CORE/MAC/src/pe/lim/limAssocUtils.h
@@ -59,18 +59,42 @@
                                      tANI_U8 , tAniAuthType,
                                      tANI_U16, tANI_U8, tSirResultCodes, tpPESession);
 
+#ifdef WLAN_FEATURE_11AC
+tSirRetStatus limPopulateOwnRateSet(tpAniSirGlobal pMac,
+                                         tpSirSupportedRates pRates,
+                                         tANI_U8* pSupportedMCSSet,
+                                         tANI_U8 basicOnly,
+                                         tpPESession psessionEntry,
+                                         tDot11fIEVHTCaps *pVHTCaps);
+
+#else
 tSirRetStatus limPopulateOwnRateSet(tpAniSirGlobal pMac,
                                                                 tpSirSupportedRates pRates,
                                                                 tANI_U8* pSupportedMCSSet,
                                                                 tANI_U8 basicOnly,
                                                                 tpPESession psessionEntry);
+#endif
 
+#ifdef WLAN_FEATURE_11AC
+tSirRetStatus
+limPopulateMatchingRateSet(tpAniSirGlobal pMac,
+                           tpDphHashNode pStaDs,
+                           tSirMacRateSet *pOperRateSet,
+                           tSirMacRateSet *pExtRateSet,
+                           tANI_U8* pSupportedMCSSet,
+                           tSirMacPropRateSet *pAniLegRateSet,
+                           tpPESession  psessionEntry,
+                           tDot11fIEVHTCaps *pVHTCaps);
+#else
 tSirRetStatus   limPopulateMatchingRateSet(tpAniSirGlobal,
                                            tpDphHashNode,
                                            tSirMacRateSet *,
                                            tSirMacRateSet *,
                                            tANI_U8* pSupportedMCSSet,
                                            tSirMacPropRateSet *, tpPESession);
+
+
+#endif
 tSirRetStatus   limAddSta(tpAniSirGlobal, tpDphHashNode,tpPESession);
 tSirRetStatus   limDelBss(tpAniSirGlobal, tpDphHashNode, tANI_U16, tpPESession);
 tSirRetStatus   limDelSta(tpAniSirGlobal, tpDphHashNode, tANI_BOOLEAN, tpPESession);
diff --git a/CORE/MAC/src/pe/lim/limFT.c b/CORE/MAC/src/pe/lim/limFT.c
index 26d04f4..ceff4da 100644
--- a/CORE/MAC/src/pe/lim/limFT.c
+++ b/CORE/MAC/src/pe/lim/limFT.c
@@ -442,7 +442,7 @@
             else
             {
                 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
-                pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+                pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
             }
             pAddBssParams->llnNonGFCoexist = (tANI_U8)beaconStruct.HTInfo.nonGFDevicesPresent;
             pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)beaconStruct.HTInfo.lsigTXOPProtectionFullSupport;
@@ -510,9 +510,14 @@
             pAddBssParams->staContext.wmmEnabled = 0;
 
         //Update the rates
-        
+#ifdef WLAN_FEATURE_11AC
+        limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates, 
+                             beaconStruct.HTCaps.supportedMCSSet, 
+                             false,pftSessionEntry,&beaconStruct.VHTCaps);
+#else
         limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates, 
                                                     beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
+#endif
         limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
 
     }
@@ -583,7 +588,7 @@
     pftSessionEntry->peSessionId = sessionId;
 
     pftSessionEntry->dot11mode = psessionEntry->dot11mode;
-    pftSessionEntry->htCapabality = psessionEntry->htCapabality;
+    pftSessionEntry->htCapability = psessionEntry->htCapability;
 
     pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
     pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
@@ -649,11 +654,6 @@
                        
     pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
     pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
-            
-    pftSessionEntry->limCurrentTitanHtCaps=
-                    pbssDescription->titanHtCaps;
-    pftSessionEntry->limReassocTitanHtCaps=
-        pftSessionEntry->limCurrentTitanHtCaps;
 
     regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel ); 
     localPowerConstraint = regMax;
@@ -1082,7 +1082,7 @@
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
     limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
 #endif
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode) 
@@ -1271,7 +1271,7 @@
      * WDA_AGGR_QOS_RSP from HAL.
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
 
     if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
     {
diff --git a/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c b/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
index e98aeae..6b118a3 100644
--- a/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
+++ b/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
@@ -325,10 +325,16 @@
     tLimIbssPeerNode *pPeer,
     tpPESession       psessionEntry)
 {
+#ifdef WLAN_FEATURE_11AC
+    limPopulateMatchingRateSet(pMac, pStaDs, &pPeer->supportedRates,
+                               &pPeer->extendedRates, pPeer->supportedMCSSet,
+                               &pStaDs->mlmStaContext.propRateSet,psessionEntry,NULL);
+#else
     // Populate supported rateset
     limPopulateMatchingRateSet(pMac, pStaDs, &pPeer->supportedRates,
                                &pPeer->extendedRates, pPeer->supportedMCSSet,
                                &pStaDs->mlmStaContext.propRateSet,psessionEntry);
+#endif
 
     pStaDs->mlmStaContext.capabilityInfo = pPeer->capabilityInfo;
 } /*** end ibss_sta_info_update() ***/
@@ -550,20 +556,10 @@
      * so that the IBSS doesnt blindly start with short slot = 1. If IBSS start is part of coalescing then it will adapt
      * to peer's short slot using code below.
      */
-    if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &cfg)
-                   != eSIR_SUCCESS)
-    {
-        limLog(pMac, LOGP, FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
-        return;
-    }
     /* If cfg is already set to current peer's capability then no need to set it again */
-    if (cfg != pBeacon->capabilityInfo.shortSlotTime)
+    if (psessionEntry->shortSlotTimeSupported != pBeacon->capabilityInfo.shortSlotTime)
     {
-        if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, pBeacon->capabilityInfo.shortSlotTime) != eSIR_SUCCESS)
-        {
-            limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
-            return;
-        }
+        psessionEntry->shortSlotTimeSupported = pBeacon->capabilityInfo.shortSlotTime;
     }
     palCopyMemory( pMac->hHdd,
        (tANI_U8 *) &psessionEntry->pLimStartBssReq->operationalRateSet,
@@ -615,10 +611,10 @@
     mlmStartReq.bssType             = eSIR_IBSS_MODE;
     mlmStartReq.beaconPeriod        = pBeacon->beaconInterval;
     mlmStartReq.nwType              = psessionEntry->pLimStartBssReq->nwType; //psessionEntry->nwType is also OK????
-    mlmStartReq.htCapable           = psessionEntry->htCapabality;
+    mlmStartReq.htCapable           = psessionEntry->htCapability;
     mlmStartReq.htOperMode          = pMac->lim.gHTOperMode;
     mlmStartReq.dualCTSProtection   = pMac->lim.gHTDualCTSProtection;
-    mlmStartReq.txChannelWidthSet   = pMac->lim.gHTRecommendedTxWidthSet;
+    mlmStartReq.txChannelWidthSet   = psessionEntry->htRecommendedTxWidthSet;
 
     #if 0
     if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &cfg) != eSIR_SUCCESS)
@@ -1006,7 +1002,7 @@
         limGetPhyMode(pMac, &phyMode, psessionEntry);
 
         //We are 11G or 11n. Check if we need protection from 11b Stations.
-        if ((phyMode == WNI_CFG_PHY_MODE_11G) || (pMac->lim.htCapability))
+        if ((phyMode == WNI_CFG_PHY_MODE_11G) || (psessionEntry->htCapability))
         {
             /* As we found in the past, it is possible that a 11n STA sends
              * Beacon with HT IE but not ERP IE.  So the absense of ERP IE
@@ -1315,18 +1311,14 @@
     limIbssDelete(pMac,psessionEntry);
     psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
     psessionEntry->limSystemRole = eLIM_STA_ROLE;
 
     /* Change the short slot operating mode to Default (which is 1 for now) so that when IBSS starts next time with Libra
      * as originator, it picks up the default. This enables us to remove hard coding of short slot = 1 from limApplyConfiguration 
      */
-    if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, WNI_CFG_SHORT_SLOT_TIME_STADEF) != eSIR_SUCCESS)
-    {
-        limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
-        return;
-    }
+    psessionEntry->shortSlotTimeSupported = WNI_CFG_SHORT_SLOT_TIME_STADEF;
 
     end:
     if(pDelBss != NULL)
@@ -1481,7 +1473,7 @@
         psessionEntry->limIbssActive = true;
         limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_IBSS_ACTIVE, NULL, 0, psessionEntry->smeSessionId);
         limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
         if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
             limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
     }
@@ -1636,7 +1628,7 @@
         limGetPhyMode(pMac, &phyMode, psessionEntry);
         erpEnabled = pStaDs->erpEnabled;
         //we are HT or 11G and 11B station is getting deleted.
-        if ( ((phyMode == WNI_CFG_PHY_MODE_11G) || pMac->lim.htCapability) 
+        if ( ((phyMode == WNI_CFG_PHY_MODE_11G) || psessionEntry->htCapability)
               && (erpEnabled == eHAL_CLEAR))
         {
             PELOGE(limLog(pMac, LOGE, FL("(%d) A legacy STA is disassociated. Addr is "),
diff --git a/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c b/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
index f9c103b..810dd9e 100644
--- a/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
+++ b/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
@@ -298,12 +298,12 @@
     pLen = pBuf;
     pBuf += sizeof(tANI_U16);
     msgLength += sizeof(tANI_U16);
-    
+
     //sessionId
-    *pBuf = psessionEntry->peSessionId;
+    *pBuf = psessionEntry->smeSessionId;
     pBuf++;
     msgLength++;
-  
+
     //transactionId
     limCopyU16((tANI_U8*)pBuf, psessionEntry->transactionId);
     pBuf += sizeof(tANI_U16);
diff --git a/CORE/MAC/src/pe/lim/limLogDump.c b/CORE/MAC/src/pe/lim/limLogDump.c
index 8271119..f15c80e 100644
--- a/CORE/MAC/src/pe/lim/limLogDump.c
+++ b/CORE/MAC/src/pe/lim/limLogDump.c
@@ -83,7 +83,7 @@
 #endif
 
 
-char *dumpLim( tpAniSirGlobal pMac, char *p )
+char *dumpLim( tpAniSirGlobal pMac, char *p, tANI_U32 sessionId)
 {
   #ifdef FIXME_GEN6
   //iterate through the sessionTable and dump sta entries for each session.
@@ -91,6 +91,13 @@
 
   tANI_U16 i, j;
 
+  tpPESession psessionEntry = peFindSessionBySessionId(pMac, sessionId);
+
+  if (psessionEntry == NULL)
+  {
+    p += log_sprintf( pMac, p, "Invalid sessionId: %d \n ", sessionId);
+    return p;
+  }
 
   p += log_sprintf( pMac,p, "\n ----- LIM Debug Information ----- \n");
   p += log_sprintf( pMac,p, "LIM Role  = (%d) %s\n",
@@ -99,11 +106,8 @@
                   pMac->lim.gLimSmeState, limSmeStateStr(pMac->lim.gLimSmeState));
   p += log_sprintf( pMac,p, "MLM State = (%d) %s",
                   pMac->lim.gLimMlmState, limMlmStateStr(pMac->lim.gLimMlmState));
-
-  p += log_sprintf( pMac,p, "CHANNEL BONDING Mode (%1d) and State (X|X|X|AU|CS|U/D|O|A) (0x%1x)\n",
-                  pMac->lim.gCbMode, pMac->lim.gCbState);
-  p += log_sprintf( pMac,p, "802.11n HT Capability: %s\n",
-                  (pMac->lim.htCapability == 1) ? "Enabled" : "Disabled");
+  p += log_sprintf( pMac,p, "802.11n session HT Capability: %s\n",
+                  (psessionEntry->htCapability == 1) ? "Enabled" : "Disabled");
   p += log_sprintf( pMac,p, "gLimProcessDefdMsgs: %s\n",
                   (pMac->lim.gLimProcessDefdMsgs == 1) ? "Enabled" : "Disabled");
 
@@ -131,10 +135,6 @@
 
       p += log_sprintf( pMac,p, "Num of Hash Miss Event ignored             = %d\n",
                       pMac->lim.gLimNumHashMissIgnored);
-
-
-
-
   }
 
   p += log_sprintf( pMac,p, "Num of RxCleanup Count                     = %d\n",
@@ -152,11 +152,6 @@
   p += log_sprintf( pMac,p, "No. of Beacons Rxed During HB Interval     = %d\n",
                   pMac->lim.gLimRxedBeaconCntDuringHB);
   p += log_sprintf( pMac,p, "Self Operating Mode                              = %s\n", limDot11ModeStr(pMac, (tANI_U8)pMac->lim.gLimDot11Mode));
-
-
-
-
-
   p += log_sprintf( pMac,p, "\n");
 
   if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
@@ -349,16 +344,13 @@
             p += log_sprintf( pMac,p, "\n");
         }
     }
-
-
 #endif
     p += log_sprintf( pMac, p, "HT operating Mode = %d, llbCoexist = %d, llgCoexist = %d, ht20Coexist = %d, nonGfPresent = %d, RifsMode = %d, lsigTxop = %d\n",
                       pMac->lim.gHTOperMode, pMac->lim.llbCoexist, pMac->lim.llgCoexist,
                       pMac->lim.ht20MhzCoexist, pMac->lim.gHTNonGFDevicesPresent,
                       pMac->lim.gHTRifsMode, pMac->lim.gHTLSigTXOPFullSupport);
-
     p += log_sprintf(pMac, p, "2nd Channel offset = %d\n",
-                  pMac->lim.gHTSecondaryChannelOffset);
+                  psessionEntry->hHTSecondaryChannelOffset);
 #endif
     return p;
 }
@@ -378,7 +370,7 @@
     tSirMsgQ mesg = { (tANI_U16) SIR_LIM_BEACON_GEN_IND, (tANI_U16) 0, (tANI_U32) 0 };
     
     pMac->lim.gLimSmeState = eLIM_SME_NORMAL_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
     pMac->lim.gLimSystemRole = eLIM_AP_ROLE;
     
     p += log_sprintf( pMac, p,
@@ -546,7 +538,7 @@
     tSirMsgQ  msg;
     tSirSmeStartBssReq  *pStartBssReq;
     unsigned char *pBuf;
-    tAniCBSecondaryMode  cbMode;
+    ePhyChanBondState  cbMode;
     tSirNwType  nwType;
 
     p += log_sprintf( pMac,p, "sendSmeStartBssReq: Preparing eWNI_SME_START_BSS_REQ message\n");
@@ -592,9 +584,9 @@
     pBuf++;
 
     // Filling in CB mode
-    cbMode = eANI_CB_SECONDARY_NONE;
-    palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(tAniCBSecondaryMode) );
-    pBuf += sizeof(tAniCBSecondaryMode);
+    cbMode = PHY_SINGLE_CHANNEL_CENTERED;
+    palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState) );
+    pBuf += sizeof(ePhyChanBondState);
 
     // Filling in RSN IE Length to zero
     palZeroMemory( pMac->hHdd, pBuf, sizeof(tANI_U16) );    //tSirRSNie->length
@@ -766,7 +758,7 @@
             p += log_sprintf( pMac,p, "bssType: (%d) %s \n", psessionEntry->bssType, limBssTypeStr(psessionEntry->bssType));
             p += log_sprintf( pMac,p, "operMode: %d \n", psessionEntry->operMode);
             p += log_sprintf( pMac,p, "dot11mode: %d \n", psessionEntry->dot11mode);
-            p += log_sprintf( pMac,p, "htCapabality: %d \n", psessionEntry->htCapabality);
+            p += log_sprintf( pMac,p, "htCapability: %d \n", psessionEntry->htCapability);
             p += log_sprintf( pMac,p, "limRFBand: %d \n", psessionEntry->limRFBand);
             p += log_sprintf( pMac,p, "limIbssActive: %d \n", psessionEntry->limIbssActive);
             p += log_sprintf( pMac,p, "limCurrentAuthType: %d \n", psessionEntry->limCurrentAuthType);
@@ -782,7 +774,6 @@
             p += log_sprintf( pMac,p, "limReassocBssCaps: %d \n", psessionEntry->limReassocBssCaps);
             p += log_sprintf( pMac,p, "limReassocBssQosCaps: %d \n", psessionEntry->limReassocBssQosCaps);
             p += log_sprintf( pMac,p, "limReassocBssPropCap: %d \n", psessionEntry->limReassocBssPropCap);
-            p += log_sprintf( pMac,p, "limReassocTitanHtCaps: %d \n", psessionEntry->limReassocTitanHtCaps);
             p += log_sprintf( pMac,p, "********************************************\n");
         }
     }
@@ -1499,30 +1490,37 @@
 static char* dump_lim_update_cb_Mode(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
 {
     tANI_U32 localPwrConstraint;
-    tpPESession psessionEntry = &pMac->lim.gpSession[0];  //TBD-RAJESH HOW TO GET sessionEntry?????
-    
-    if ( !pMac->lim.htCapability )
+    tpPESession psessionEntry = peFindSessionBySessionId(pMac, arg1);
+
+    if (psessionEntry == NULL)
+    {
+      p += log_sprintf( pMac, p, "Invalid sessionId: %d \n ", arg1);
+      return p;
+    }
+
+    if ( !psessionEntry->htCapability )
     {
         p += log_sprintf( pMac,p, "Error: Dot11 mode is non-HT, can not change the CB mode.\n");
         return p;
     }
-    
-    pMac->lim.gHTSecondaryChannelOffset = arg1;
-    setupCBState(pMac,  limGetAniCBState(pMac->lim.gHTSecondaryChannelOffset));
+
+    psessionEntry->htSupportedChannelWidthSet = arg2?1:0;
+    psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
+    psessionEntry->htSecondaryChannelOffset = arg2;
 
     if(eSIR_SUCCESS != cfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE,  
-                                    arg1 ? WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE))
+                                    arg2 ? WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE))
         p += log_sprintf(pMac,p, "cfgSetInt failed for WNI_CFG_CHANNEL_BONDING_MODE\n");
-    
+
     wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint);
-        
-    limSendSwitchChnlParams(pMac, psessionEntry->currentOperChannel, pMac->lim.gHTSecondaryChannelOffset,
+
+    limSendSwitchChnlParams(pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset,
                                                                   (tPowerdBm) localPwrConstraint, psessionEntry->peSessionId);
     if ( (limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
           (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE))
            schSetFixedBeaconFields(pMac,psessionEntry);
     return p;
-    
+
 }
 
 static char* dump_lim_abort_scan(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
@@ -1712,6 +1710,7 @@
 static char *
 dump_lim_dot11h_stats( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
 {
+#if 0
     unsigned int i;
     (void) arg1; (void) arg2; (void) arg3; (void) arg4;
 
@@ -1780,6 +1779,7 @@
     }
     p += log_sprintf(pMac, p, "\n");
     
+#endif
     return p;
 }
 
@@ -1806,7 +1806,7 @@
 dump_lim_enable_quietIE( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
 {
     (void) arg2; (void) arg3; (void) arg4;
-
+#if 0
     if (arg1)
     {
         pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_TRUE;
@@ -1817,6 +1817,7 @@
         pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_FALSE;
         p += log_sprintf(pMac, p, "QuietIE disabled\n");
     }
+#endif
 
     return p;
 }
@@ -1858,8 +1859,8 @@
 static char *
 dump_lim_info( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
 {
-    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
-    p = dumpLim( pMac, p );
+    (void) arg2; (void) arg3; (void) arg4;
+    p = dumpLim( pMac, p, arg1);
     return p;
 }
 
@@ -2305,10 +2306,61 @@
     return p;    
 }
 #endif
+static char *
+dump_lim_channel_switch_announcement( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    tpPESession psessionEntry;
+    tANI_U8 nMode = arg2;
+    tANI_U8 nNewChannel = arg3;
+    tANI_U8 nCount = arg4;
+  tANI_U8 peer[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
 
+    if((psessionEntry = peFindSessionBySessionId(pMac,(tANI_U8)arg1) )== NULL)
+    {
+        p += log_sprintf( pMac,
+            p,"Session does not exist usage: 363 <0> sessionid channel \n");
+        printk("Session Not found!!!!\n");
+        return p;
+    }
+
+    limSendChannelSwitchMgmtFrame( pMac, peer, nMode, nNewChannel, nCount, psessionEntry );
+
+    psessionEntry->gLimChannelSwitch.switchCount = nCount;
+    psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
+    psessionEntry->gLimChannelSwitch.switchMode = nMode;
+    psessionEntry->gLimChannelSwitch.primaryChannel = nNewChannel;
+
+    schSetFixedBeaconFields(pMac, psessionEntry);
+    limSendBeaconInd(pMac, psessionEntry); 
+
+  return p;
+}
+
+static char *
+dump_lim_cancel_channel_switch_announcement( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
+{
+    tpPESession psessionEntry;
+
+    if((psessionEntry = peFindSessionBySessionId(pMac,(tANI_U8)arg1) )== NULL)
+    {
+        p += log_sprintf( pMac,
+            p,"Session does not exist usage: 363 <0> sessionid channel \n");
+        printk("Session Not found!!!!\n");
+        return p;
+    }
+    psessionEntry->gLimChannelSwitch.switchCount = 0;
+    psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
+    psessionEntry->gLimChannelSwitch.switchMode = 0;
+    psessionEntry->gLimChannelSwitch.primaryChannel = 0;
+
+    schSetFixedBeaconFields(pMac, psessionEntry);
+    limSendBeaconInd(pMac, psessionEntry); 
+
+  return p;
+}
 static tDumpFuncEntry limMenuDumpTable[] = {
     {0,     "PE (300-499)",                                          NULL},
-    {300,   "LIM: Dump state(s)/statistics",                         dump_lim_info},
+    {300,   "LIM: Dump state(s)/statistics <session id>",            dump_lim_info},
     {301,   "PE.LIM: dump TSPEC Table",                              dump_lim_tspec_table},
     {302,   "PE.LIM: dump specified TSPEC entry (id)",               dump_lim_tspec_entry},
     {303,   "PE.LIM: dump EDCA params",                              dump_lim_edca_params},
@@ -2347,7 +2399,7 @@
     {346,   "PE:LIM: Set the Dot11 Mode",                            dump_lim_set_dot11_mode},
     {347,   "PE:Enable or Disable Protection",                       dump_lim_set_protection_control},
     {348,   "PE:LIM: Send SM Power Mode Action frame",               dump_lim_send_SM_Power_Mode},
-    {349,   "PE: LIM: Change CB Mode",                               dump_lim_update_cb_Mode},
+    {349,   "PE: LIM: Change CB Mode <session id> <sec chnl offset>",dump_lim_update_cb_Mode},
     {350,   "PE: LIM: abort scan",                                   dump_lim_abort_scan},
     {351,   "PE: LIM: Start stop BG scan",                           dump_lim_start_stop_bg_scan},
     {352,   "PE: LIM: PE statistics <scanmask>",                     dump_lim_get_pe_statistics},
@@ -2370,6 +2422,8 @@
 #ifdef WLAN_FEATURE_VOWIFI_11R
     {363,   "PE.LIM: trigger pre auth/reassoc event",                dump_lim_ft_event},
 #endif
+    {364,   "PE.LIM: Send a channel switch announcement",            dump_lim_channel_switch_announcement},
+    {365,   "PE.LIM: Cancel channel switch announcement",            dump_lim_cancel_channel_switch_announcement},
 
 };
 
diff --git a/CORE/MAC/src/pe/lim/limP2P.c b/CORE/MAC/src/pe/lim/limP2P.c
index 6f4d465..1b99e87 100644
--- a/CORE/MAC/src/pe/lim/limP2P.c
+++ b/CORE/MAC/src/pe/lim/limP2P.c
@@ -60,6 +60,8 @@
 #define   BSSID_OFFSET           16
 #define   ADDR2_OFFSET           10
 #define   ACTION_OFFSET          24
+#define   LIM_MIN_REM_TIME_FOR_TX_ACTION_FRAME                     30
+#define   LIM_MIN_REM_TIME_EXT_FOR_TX_ACTION_FRAME                 40
 
 
 
@@ -76,7 +78,7 @@
                          tpSetLinkStateCallback callback, void *callbackArg);
 
 static tSirRetStatus limCreateSessionForRemainOnChn(tpAniSirGlobal pMac, tPESession **ppP2pSession);
-
+eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess);
 /*------------------------------------------------------------------
  *
  * Below function is callback function, it is called when 
@@ -129,6 +131,8 @@
                 tANI_U32 val;
                 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
+                pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time();
+                pMac->lim.gTotalScanDuration = MsgBuff->duration;
 
                 /* get the duration from the request */
                 val = SYS_MS_TO_TICKS(MsgBuff->duration);
@@ -315,6 +319,8 @@
     // Start timer here to come back to operating channel.
     pMac->lim.limTimers.gLimRemainOnChannelTimer.sessionId =
                                                 psessionEntry->peSessionId;
+    pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time();
+    pMac->lim.gTotalScanDuration = MsgRemainonChannel->duration;
 
       /* get the duration from the request */
     val = SYS_MS_TO_TICKS(MsgRemainonChannel->duration);
@@ -367,6 +373,15 @@
     tpPESession psessionEntry;
     tSirMacAddr             nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
+    //Timer might get extended while Sending Action Frame
+    //In that case don't process Channel Timeout
+    if (tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer))
+    {
+        limLog( pMac, LOGE, 
+                "still timer is running already and not processing limProcessRemainOnChnTimeout");
+        return;
+    }
+
     limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
 
     if (NULL == pMac->lim.gpLimRemainOnChanReq)
@@ -480,6 +495,7 @@
            peDeleteSession( pMac, psessionEntry);
         }
     }
+
     /* Post the meessage to Sme */
     limSendSmeRsp(pMac, eWNI_SME_REMAIN_ON_CHN_RSP, status, 
                   MsgRemainonChannel->sessionId, 0);
@@ -488,6 +504,14 @@
     pMac->lim.gpLimRemainOnChanReq = NULL;
 
     pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+
+    /* If remain on channel timer expired and action frame is pending then 
+     * indicaiton confirmation with status failure */
+    if (pMac->lim.actionFrameSessionId != 0xff)
+    {
+       limP2PActionCnf(pMac, 0);
+    }
+
     return;
 }
 
@@ -500,7 +524,7 @@
 void limSendSmeMgmtFrameInd(
                     tpAniSirGlobal pMac, tANI_U8 frameType,
                     tANI_U8  *frame, tANI_U32 frameLen, tANI_U16 sessionId,
-                    tANI_U32 rxChannel)
+                    tANI_U32 rxChannel, tpPESession psessionEntry)
 {
     tSirMsgQ              mmhMsg;
     tpSirSmeMgmtFrameInd pSirSmeMgmtFrame = NULL;
@@ -521,7 +545,21 @@
     pSirSmeMgmtFrame->mesgLen = length;
     pSirSmeMgmtFrame->sessionId = sessionId;
     pSirSmeMgmtFrame->frameType = frameType;
-    pSirSmeMgmtFrame->rxChan = rxChannel;
+
+    /* work around for 5Ghz channel is not correct since rxhannel 
+     * is 4 bits. So we don't indicate more than 16 channels 
+     */
+    if( (VOS_FALSE == 
+        tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer)) &&
+        (psessionEntry != NULL) && 
+        (SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) ) 
+    {
+        pSirSmeMgmtFrame->rxChan = psessionEntry->currentOperChannel;
+    }
+    else
+    {
+        pSirSmeMgmtFrame->rxChan = rxChannel;
+    }
 
     vos_mem_zero(pSirSmeMgmtFrame->frameBuf,frameLen);
     vos_mem_copy(pSirSmeMgmtFrame->frameBuf,frame,frameLen);
@@ -529,6 +567,41 @@
     mmhMsg.type = eWNI_SME_MGMT_FRM_IND;
     mmhMsg.bodyptr = pSirSmeMgmtFrame;
     mmhMsg.bodyval = 0;
+
+    if(VOS_TRUE == tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer) && 
+            ( (psessionEntry != NULL) && (psessionEntry->pePersona != VOS_P2P_GO_MODE)) &&
+            (frameType == SIR_MAC_MGMT_ACTION))
+    {
+        tANI_U32 curTime = vos_timer_get_system_time();
+        if((curTime - pMac->lim.p2pRemOnChanTimeStamp) > (pMac->lim.gTotalScanDuration - LIM_MIN_REM_TIME_FOR_TX_ACTION_FRAME))
+        {
+            unsigned int chanWaitTime, vStatus ;
+
+            limLog( pMac, LOG1, FL("Rx: Extend the gLimRemainOnChannelTimer"));
+
+            pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time();
+            pMac->lim.gTotalScanDuration = LIM_MIN_REM_TIME_EXT_FOR_TX_ACTION_FRAME;
+
+            chanWaitTime = SYS_MS_TO_TICKS(40);
+            vStatus = tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
+
+            if (VOS_STATUS_SUCCESS != vStatus)
+            {     
+                limLog( pMac, LOGE, FL("Rx: Extend the gLimRemainOnChannelTimer"));
+            } 
+
+            if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer, chanWaitTime, 0) != TX_SUCCESS)
+            {
+                limLog( pMac, LOGE, FL("Unable to change the gLimRemainOnChannelTimer"));
+            }
+
+            if (tx_timer_activate(&pMac->lim.limTimers.gLimRemainOnChannelTimer) != 0)
+            {
+                limLog( pMac, LOGE, FL("Unable to active the gLimRemainOnChannelTimer"));
+            } 
+        } 
+    }
+
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
     return;
 } /*** end limSendSmeListenRsp() ***/
@@ -536,20 +609,26 @@
 
 eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess)
 {
-    limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
-            (txCompleteSuccess ? eSIR_SME_SUCCESS : eSIR_SME_SEND_ACTION_FAIL),
-             pMac->lim.actionFrameSessionId, 0);
+    if (pMac->lim.actionFrameSessionId != 0xff)
+    {
+        /* The session entry might be invalid(0xff) action confirmation received after
+         * remain on channel timer expired */
+        limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
+                (txCompleteSuccess ? eSIR_SME_SUCCESS : eSIR_SME_SEND_ACTION_FAIL),
+                pMac->lim.actionFrameSessionId, 0);
+        pMac->lim.actionFrameSessionId = 0xff;
+    }
 
     return eHAL_STATUS_SUCCESS;
 }
 
 
-void limSetHtCaps(tpAniSirGlobal pMac,tANI_U8 *pIeStartPtr,tANI_U32 nBytes)
+void limSetHtCaps(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 *pIeStartPtr,tANI_U32 nBytes)
 {
     v_U8_t              *pIe=NULL;
     tDot11fIEHTCaps     dot11HtCap;
 
-    PopulateDot11fHTCaps(pMac,&dot11HtCap);
+    PopulateDot11fHTCaps(pMac, psessionEntry, &dot11HtCap);
     pIe = limGetIEPtr(pMac,pIeStartPtr, nBytes,
                                        DOT11F_EID_HTCAPS,ONE_BYTE);
    limLog( pMac, LOGE, FL("pIe 0x%x dot11HtCap.supportedMCSSet[0]=0x%x"),
@@ -772,9 +851,53 @@
 
         if (SIR_MAC_MGMT_PROBE_RSP == pFc->subType)
         {
-            limSetHtCaps( pMac,(tANI_U8*)pMbMsg->data + PROBE_RSP_IE_OFFSET,
+            limSetHtCaps( pMac, psessionEntry, (tANI_U8*)pMbMsg->data + PROBE_RSP_IE_OFFSET,
                            nBytes);
         }
+        
+        /* The minimum wait for any action frame should be atleast 100 ms.
+         * If supplicant sends action frame at the end of already running remain on channel time
+         * Then there is a chance to miss the response of the frame. So increase the remain on channel
+         * time for all action frame to make sure that we receive the response frame */
+        if ((SIR_MAC_MGMT_ACTION == pFc->subType) &&
+                (0 != pMbMsg->wait))
+        {
+            if (tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer))
+            {
+                tANI_U32 val = 0;
+                tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
+                /* get the duration from the request */
+                pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time();
+                pMac->lim.gTotalScanDuration = pMbMsg->wait;
+
+                val = SYS_MS_TO_TICKS(pMbMsg->wait);
+
+                limLog(pMac, LOG1,
+                        FL("Tx: Extending the gLimRemainOnChannelTimer\n"));
+                if (tx_timer_change(
+                            &pMac->lim.limTimers.gLimRemainOnChannelTimer, val, 0)
+                        != TX_SUCCESS)
+                {
+                    limLog(pMac, LOGP,
+                            FL("Unable to change remain on channel Timer val\n"));
+                    return;
+                }
+                else if(TX_SUCCESS != tx_timer_activate(
+                            &pMac->lim.limTimers.gLimRemainOnChannelTimer))
+                {
+                    limLog(pMac, LOGP,
+                            FL("Unable to activate remain on channel Timer\n"));
+                    limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
+                    return;
+                }
+            }
+            else
+            {
+                limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, 
+                        eHAL_STATUS_FAILURE, pMbMsg->sessionId, 0);
+                return;
+            }
+        }
     }
 
 
@@ -812,15 +935,21 @@
      */
     txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
 
-    if (SIR_MAC_MGMT_PROBE_RSP == pFc->subType)
+    if ( (SIR_MAC_MGMT_PROBE_RSP == pFc->subType) ||
+         (pMbMsg->noack)
+        )
     {
         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 );
 
-        limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, 
+        if (!pMbMsg->noack)
+        {
+           limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, 
                halstatus, pMbMsg->sessionId, 0);
+        }
+        pMac->lim.actionFrameSessionId = 0xff;
     }
     else
     {
@@ -834,10 +963,14 @@
              limLog( pMac, LOGE, FL("could not send action frame!\n" ));
              limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, halstatus, 
                 pMbMsg->sessionId, 0);
+             pMac->lim.actionFrameSessionId = 0xff;
         }
         else
         {
              pMac->lim.actionFrameSessionId = pMbMsg->sessionId;
+             limLog( pMac, LOGE, FL("lim.actionFrameSessionId = %lu\n" ), 
+                     pMac->lim.actionFrameSessionId);
+
         }
     }
 
diff --git a/CORE/MAC/src/pe/lim/limProcessActionFrame.c b/CORE/MAC/src/pe/lim/limProcessActionFrame.c
index 4c89a87..016cc10 100644
--- a/CORE/MAC/src/pe/lim/limProcessActionFrame.c
+++ b/CORE/MAC/src/pe/lim/limProcessActionFrame.c
@@ -57,6 +57,7 @@
 #if defined WLAN_FEATURE_VOWIFI
 #include "rrmApi.h"
 #endif
+#include "limSessionUtils.h"
 
 #if defined FEATURE_WLAN_CCX
 #include "ccxApi.h"
@@ -88,12 +89,21 @@
 void limStopTxAndSwitchChannel(tpAniSirGlobal pMac, tANI_U8 sessionId)
 {
     tANI_U8 isFullPowerRequested = 0;
+    tpPESession psessionEntry;
+
+    psessionEntry = peFindSessionBySessionId( pMac , sessionId );
+
+    if( NULL == psessionEntry )
+    {
+      limLog(pMac, LOGE, FL("Session %d  not active\n "), sessionId);
+      return;
+    }
 
     PELOG1(limLog(pMac, LOG1, FL("Channel switch Mode == %d\n"), 
-                       pMac->lim.gLimChannelSwitch.switchMode);)
+                       psessionEntry->gLimChannelSwitch.switchMode);)
 
-    if (pMac->lim.gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
-        pMac->lim.gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
+    if (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
+        psessionEntry->gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
     {
         /* Freeze the transmission */
         limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
@@ -112,11 +122,12 @@
         limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
     }
 
+    pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
     /* change the channel immediatly only if the channel switch count is 0 and the 
      * device is not in powersave 
      * If the device is in powersave channel switch should happen only after the
      * device comes out of the powersave */
-    if (pMac->lim.gLimChannelSwitch.switchCount == 0) 
+    if (psessionEntry->gLimChannelSwitch.switchCount == 0) 
     {
         if(limIsSystemInActiveState(pMac))
         {
@@ -131,10 +142,8 @@
         }
         return;
     }
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_CHANNEL_SWITCH_TIMER));
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_CHANNEL_SWITCH_TIMER));
-
-    pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
 
     if (tx_timer_activate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != TX_SUCCESS)
     {
@@ -156,31 +165,54 @@
 tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
 {
     PELOG1(limLog(pMac, LOG1, FL("Starting the channel switch\n"));)
+    
+    /*If channel switch is already running and it is on a different session, just return*/  
+    /*This need to be removed for MCC */
+    if( limIsChanSwitchRunning (pMac) &&
+        psessionEntry->gLimSpecMgmt.dot11hChanSwState != eLIM_11H_CHANSW_RUNNING )
+    {
+       limLog(pMac, LOGW, FL("Ignoring channel switch on session %d\n"), psessionEntry->peSessionId);
+       return eSIR_SUCCESS;
+    }
+     
     /* Deactivate and change reconfigure the timeout value */
-    limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
+    //limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
+    if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("tx_timer_deactivate failed!\n"));
+        return eSIR_FAILURE;
+    }
+
+    if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
+                psessionEntry->gLimChannelSwitch.switchTimeoutValue,
+                            0) != TX_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("tx_timer_change failed \n"));
+        return eSIR_FAILURE;
+    }
 
     /* Follow the channel switch, forget about the previous quiet. */
     //If quiet is running, chance is there to resume tx on its timeout.
     //so stop timer for a safer side.
-    if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
+    if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
         {
             limLog(pMac, LOGP, FL("tx_timer_deactivate failed\n"));
             return eSIR_FAILURE;
         }
     }
-    else if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
+    else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
         {
             limLog(pMac, LOGP, FL("tx_timer_deactivate failed\n"));
             return eSIR_FAILURE;
         }
     }
-    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+    psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
 
     /* Prepare for 11h channel switch */
     limPrepareFor11hChannelSwitch(pMac, psessionEntry);
@@ -276,37 +308,26 @@
 
         beaconPeriod = (tANI_U16) val;
 
-        pMac->lim.gLimChannelSwitch.primaryChannel = pChannelSwitchFrame->ChanSwitchAnn.newChannel;
-        pMac->lim.gLimChannelSwitch.switchCount = pChannelSwitchFrame->ChanSwitchAnn.switchCount;
-        pMac->lim.gLimChannelSwitch.switchTimeoutValue = SYS_MS_TO_TICKS(beaconPeriod) *
-                                                         pMac->lim.gLimChannelSwitch.switchCount;
-        pMac->lim.gLimChannelSwitch.switchMode = pChannelSwitchFrame->ChanSwitchAnn.switchMode;
+        psessionEntry->gLimChannelSwitch.primaryChannel = pChannelSwitchFrame->ChanSwitchAnn.newChannel;
+        psessionEntry->gLimChannelSwitch.switchCount = pChannelSwitchFrame->ChanSwitchAnn.switchCount;
+        psessionEntry->gLimChannelSwitch.switchTimeoutValue = SYS_MS_TO_TICKS(beaconPeriod) *
+                                                         psessionEntry->gLimChannelSwitch.switchCount;
+        psessionEntry->gLimChannelSwitch.switchMode = pChannelSwitchFrame->ChanSwitchAnn.switchMode;
 
        PELOG3(limLog(pMac, LOG3, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks\n"),
-                             pMac->lim.gLimChannelSwitch.switchTimeoutValue);)
+                             psessionEntry->gLimChannelSwitch.switchTimeoutValue);)
 
         /* Only primary channel switch element is present */
-        pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
-        pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_NONE;
+        psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
+        psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
 
-        if(GET_CB_ADMIN_STATE(pMac->lim.gCbState))
+        if (psessionEntry->htSupportedChannelWidthSet)
         {
-            switch(pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset)
+            if ((pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
+                (pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
             {
-                case eHT_SECONDARY_CHANNEL_OFFSET_UP:
-                    pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
-                    pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_UP;
-                    break;
-
-                case eHT_SECONDARY_CHANNEL_OFFSET_DOWN:
-                    pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
-                    pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_DOWN;
-                    break;
-
-                case eHT_SECONDARY_CHANNEL_OFFSET_NONE:
-                default:
-                    /* Nothing to be done here */
-                    break;
+                psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+                psessionEntry->gLimChannelSwitch.secondarySubBand = pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset;
             }
         }
 
@@ -779,7 +800,7 @@
     else
     {
       //send message to HAL to delete TS
-      if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, delts))
+      if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, delts, psessionEntry->peSessionId))
       {
         limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request\n"),
                          tsinfo->traffic.userPrio);
@@ -1987,7 +2008,7 @@
                  // type is ACTION
                  limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType, 
                     (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0, 
-                    WDA_GET_RX_CH( pRxPacketInfo ));
+                    WDA_GET_RX_CH( pRxPacketInfo ), psessionEntry);
               }
               else
               {
@@ -2068,7 +2089,7 @@
                   // type is ACTION
                   limSendSmeMgmtFrameInd(pMac, pHdr->fc.subType, 
                       (tANI_U8*)pHdr, frameLen + sizeof(tSirMacMgmtHdr), 0,
-                      WDA_GET_RX_CH( pBd ));
+                      WDA_GET_RX_CH( pBd ), NULL);
                 }
                 else
                 {
diff --git a/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c b/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
index 6ee945d..5754e5e 100644
--- a/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
+++ b/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
@@ -220,6 +220,18 @@
     limLog(pMac, LOG2, FL("Received AssocReq Frame: "));
     sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen);
 
+    if( palEqualMemory( pMac->hHdd,  (tANI_U8* ) pHdr->sa, (tANI_U8 *) pHdr->da, 
+                        (tANI_U8) (sizeof(tSirMacAddr))))
+    {
+        limSendAssocRspMgmtFrame(pMac,
+                    eSIR_MAC_UNSPEC_FAILURE_STATUS,
+                    1,
+                    pHdr->sa,
+                    subType, 0,psessionEntry);
+        limLog(pMac, LOGE, FL("Rejected Assoc Req frame Since same mac as SAP/GO\n"));
+        return ;
+    }
+
 #ifdef WLAN_SOFTAP_FEATURE
     // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON
     if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
@@ -601,7 +613,7 @@
 
     // Check for 802.11n HT caps compatibility; are HT Capabilities
     // turned on in lim?
-    if ( psessionEntry->htCapabality )
+    if ( psessionEntry->htCapability )
     {
         // There are; are they turned on in the STA?
         if ( pAssocReq->HTCaps.present )
@@ -870,6 +882,7 @@
             }
             limPrintMacAddr(pMac, pHdr->sa, LOG1);
             limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState);
+
             goto error;
         } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
 
@@ -1012,6 +1025,9 @@
     psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
 
     pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present;
+#ifdef WLAN_FEATURE_11AC
+    pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present;
+#endif
     pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true;
     pStaDs->qos.addts        = pAssocReq->addtsReq;
     pStaDs->qos.capability   = pAssocReq->qosCapability;
@@ -1067,10 +1083,30 @@
         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
+         */
+        pStaDs->htSecondaryChannelOffset = (pStaDs->htSupportedChannelWidthSet)?psessionEntry->htSecondaryChannelOffset:0;
+#ifdef WLAN_FEATURE_11AC
+        if (pAssocReq->VHTCaps.present)
+        {
+            pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)pAssocReq->VHTCaps.supportedChannelWidthSet; 
+        }
+#endif
         pStaDs->baPolicyFlag = 0xFF;
     }
 
 
+#ifdef WLAN_FEATURE_11AC
+if (limPopulateMatchingRateSet(pMac,
+                               pStaDs,
+                               &(pAssocReq->supportedRates),
+                               &(pAssocReq->extendedRates),
+                               pAssocReq->HTCaps.supportedMCSSet,
+                               &(pAssocReq->propIEinfo.propRates),
+                               psessionEntry , &pAssocReq->VHTCaps) 
+                               != eSIR_SUCCESS)
+#else
 
     if (limPopulateMatchingRateSet(pMac,
                                    pStaDs,
@@ -1078,6 +1114,7 @@
                                    &(pAssocReq->extendedRates),
                                    pAssocReq->HTCaps.supportedMCSSet,
                                    &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
+#endif
     {
         // Could not update hash table entry at DPH with rateset
         limLog(pMac, LOGE,
@@ -1262,8 +1299,11 @@
         }
     }
 
-    if(pStaDs!= NULL)
+    /* If it is not duplicate Assoc request then only make to Null */
+    if ((pStaDs != NULL) &&
+          (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE))
         psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
+
     return;
 
 } /*** end limProcessAssocReqFrame() ***/
@@ -1396,10 +1436,6 @@
                            pAssocReq->rsn.length);
         }
 
-        //FIXME: we need to have the cb information seprated between HT and Titan later. 
-        if(pAssocReq->HTCaps.present)
-            limGetHtCbAdminState(pMac, pAssocReq->HTCaps, &pMlmAssocInd->titanHtCaps);
-
         // Fill in 802.11h related info
         if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
         {
@@ -1554,9 +1590,6 @@
             palCopyMemory( pMac->hHdd, &pMlmReassocInd->rsnIE.rsnIEdata[2], pAssocReq->rsn.info, pAssocReq->rsn.length);
         }
 
-        if(pAssocReq->HTCaps.present)
-              limGetHtCbAdminState(pMac, pAssocReq->HTCaps,  &pMlmReassocInd->titanHtCaps );
-
         // 802.11h support
         if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
         {
diff --git a/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c b/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
index b76995a..77cf321 100644
--- a/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
+++ b/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
@@ -128,6 +128,8 @@
                    pStaDs->htMaxRxAMpduFactor = pAssocRsp->HTCaps.maxRxAMPDUFactor;
                    limFillRxHighestSupportedRate(pMac, &rxHighestRate, pAssocRsp->HTCaps.supportedMCSSet);
                    pStaDs->supportedRates.rxHighestDataRate = rxHighestRate;
+                   /* This is for AP as peer STA and we are INFRA STA. We will put APs offset in dph node which is peer STA */
+                   pStaDs->htSecondaryChannelOffset = (tANI_U8)pAssocRsp->HTInfo.secondaryChannelOffset;
 
                    //FIXME_AMPDU
                    // In the future, may need to check for "assoc.HTCaps.delayedBA"
@@ -135,8 +137,19 @@
                    pStaDs->baPolicyFlag = 0xFF;
            }
        }
-    
-       if (limPopulateOwnRateSet(pMac, &pStaDs->supportedRates, pAssocRsp->HTCaps.supportedMCSSet, false,psessionEntry) != eSIR_SUCCESS) {
+
+#ifdef WLAN_FEATURE_11AC
+       if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
+       {
+           pStaDs->mlmStaContext.vhtCapability = pAssocRsp->VHTCaps.present;
+       }
+       if (limPopulateOwnRateSet(pMac, &pStaDs->supportedRates, 
+                                pAssocRsp->HTCaps.supportedMCSSet,
+                                false,psessionEntry , &pAssocRsp->VHTCaps) != eSIR_SUCCESS) 
+#else
+       if (limPopulateOwnRateSet(pMac, &pStaDs->supportedRates, pAssocRsp->HTCaps.supportedMCSSet, false,psessionEntry) != eSIR_SUCCESS) 
+#endif
+       {
            limLog(pMac, LOGP, FL("could not get rateset and extended rate set\n"));
            return;
        }
@@ -231,10 +244,13 @@
     palCopyMemory( pMac->hHdd, psessionEntry->bssId,
                   psessionEntry->limReAssocbssId, sizeof(tSirMacAddr));
     psessionEntry->currentOperChannel = psessionEntry->limReassocChannelId;
+    psessionEntry->htSecondaryChannelOffset = psessionEntry->reAssocHtSupportedChannelWidthSet;
+    psessionEntry->htRecommendedTxWidthSet = psessionEntry->reAssocHtRecommendedTxWidthSet;
+    psessionEntry->htSecondaryChannelOffset = psessionEntry->reAssocHtSecondaryChannelOffset;
     psessionEntry->limCurrentBssCaps   = psessionEntry->limReassocBssCaps;
     psessionEntry->limCurrentBssQosCaps = psessionEntry->limReassocBssQosCaps;
     psessionEntry->limCurrentBssPropCap = psessionEntry->limReassocBssPropCap;
-    psessionEntry->limCurrentTitanHtCaps = psessionEntry->limReassocTitanHtCaps;
+
     palCopyMemory( pMac->hHdd, (tANI_U8 *) &psessionEntry->ssId,
                   (tANI_U8 *) &psessionEntry->limReassocSSID,
                   psessionEntry->limReassocSSID.length+1);
@@ -243,7 +259,7 @@
     psessionEntry->limAID = pAssocRsp->aid & 0x3FFF;
     /** Set the State Back to ReAssoc Rsp*/
     psessionEntry->limMlmState = eLIM_MLM_WT_REASSOC_RSP_STATE; 
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
     
 }
@@ -748,17 +764,15 @@
 #endif
        ) {
         PELOGE(limLog(pMac, LOGE,  FL("Assoc Rejected by the peer. Reason: %d\n"), mlmAssocCnf.resultCode);)
-        pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
         if (psessionEntry->pLimMlmJoinReq)
         {
             palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq);
             psessionEntry->pLimMlmJoinReq = NULL;
         }
-        if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId, 
-             psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
-            PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState\n"));)
+
         if (subType == LIM_ASSOC)
         {
            limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, (tANI_U32 *) &mlmAssocCnf);
diff --git a/CORE/MAC/src/pe/lim/limProcessAuthFrame.c b/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
index 08fd818..5049af5 100644
--- a/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
+++ b/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
@@ -192,7 +192,7 @@
 
     pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
 
-    PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8*)pBd, ((tpHalBufDesc) pBd)->mpduDataOffset + frameLen);)
+    //PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8*)pBd, ((tpHalBufDesc) pBd)->mpduDataOffset + frameLen);)
 
 
    
@@ -1162,7 +1162,7 @@
                                                     encrAuthFrame,key_length);
 
                                 psessionEntry->limMlmState = eLIM_MLM_WT_AUTH_FRAME4_STATE;
-                                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+                                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
                                 limSendAuthMgmtFrame(pMac,
                                                      (tpSirMacAuthFrameBody) encrAuthFrame,
@@ -1243,7 +1243,7 @@
 
                                 psessionEntry->limMlmState =
                                 eLIM_MLM_WT_AUTH_FRAME4_STATE;
-                                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+                                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
                                 limSendAuthMgmtFrame(pMac,
                                                      (tpSirMacAuthFrameBody) encrAuthFrame,
diff --git a/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c b/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
index e797901..5b2e128 100644
--- a/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
+++ b/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
@@ -119,8 +119,8 @@
         }
 
 
-        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, beacon.timeStamp[0]);)
-        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, beacon.timeStamp[1]);)
+       MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, beacon.timeStamp[0]);)
+       MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, beacon.timeStamp[1]);)
 
 
         if ((pMac->lim.gLimMlmState  == eLIM_MLM_WT_PROBE_RESP_STATE) ||
diff --git a/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c b/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
index 726da44..0e82c0d 100644
--- a/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
+++ b/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
@@ -129,101 +129,6 @@
 
 } /*** end limSetDefaultKeyIdAndKeys() ***/
 
-
-/**
- * handleCBCFGChange()
- *
- *FUNCTION:
- *
- *PARAMS:
- *
- *LOGIC:
- *
- *ASSUMPTIONS:
- * If this API is invoked with
- *   cfgId == ANI_IGNORE_CFG_ID
- * Then,
- *   this routine will traverse thru' ALL the
- *   related CFG's that are statically setup
- * Else,
- *   only update this "1" CFG identified by cfgId
- *
- *NOTE:
- *
- * @param  pMac  - Pointer to Global MAC structure
- * @param  cfgId - ID of CFG parameter that got updated
- * @return None
- */
-void handleCBCFGChange( tpAniSirGlobal pMac, tANI_U32 cfgId )
-{
-tANI_U32 cfg, val, i = 0;
-tANI_U32 defaultCfgList[] = { 
-  WNI_CFG_CHANNEL_BONDING_MODE,
-  ANI_IGNORE_CFG_ID };
-
-  do
-  {
-    //
-    // Determine if we have to use our own default CFG list
-    // OR should we use the argument passed to us
-    //
-    if( ANI_IGNORE_CFG_ID == cfgId )
-      cfg = defaultCfgList[i]; // "n" iterations reqd
-    else
-      cfg = cfgId; // Just "1" iteration reqd
-
-    switch( cfg )
-    {
-      case WNI_CFG_CHANNEL_BONDING_MODE:
-        if( eSIR_SUCCESS != wlan_cfgGetInt( pMac,
-              WNI_CFG_CHANNEL_BONDING_MODE,
-              &val ))
-        {
-          limLog( pMac, LOGW,
-              FL("Unable to retrieve CHANNEL BONDING Mode from CFG. Defaulting to DISABLE\n"));
-          pMac->lim.gCbMode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
-        }
-        else
-          pMac->lim.gCbMode = (tANI_U8) val;
-
-        // Now, set the CHANNEL BONDING state apropriately
-        switch( pMac->lim.gCbMode )
-        {
-          // Always OFF
-          case WNI_CFG_CHANNEL_BONDING_MODE_DISABLE:
-            SET_CB_STATE_DISABLE( pMac->lim.gCbState );
-            break;
-
-          // Always ON
-          case WNI_CFG_CHANNEL_BONDING_MODE_ENABLE:
-            SET_CB_STATE_ENABLE( pMac->lim.gCbState );
-            break;
-
-          default:
-            SET_CB_STATE_ENABLE( pMac->lim.gCbState );
-            break;
-        }
-        break;
-
-      default:
-          break;
-    }
-
-    // DEBUG LOG the TITAN CFG's
-    limLog( pMac, LOG1,
-        FL("The TITAN related global CFG's are: "
-          "cbMode - %1d cbState - %1d\n"),
-        pMac->lim.gCbMode, pMac->lim.gCbState);
-
-    // If only "1" CFG needs an update, then return
-    if( ANI_IGNORE_CFG_ID == cfgId )
-      i++;
-    else
-      break;
-
-  } while( ANI_IGNORE_CFG_ID != defaultCfgList[i] ); // End-Of-List?
-}
-
 /** -------------------------------------------------------------
 \fn limSetCfgProtection
 \brief sets lim global cfg cache from the config.
@@ -371,10 +276,8 @@
 {
     tANI_U32 val1, val2;
     tANI_U16 val16;
-    tANI_U8 val8;
     tSirMacHTCapabilityInfo   *pHTCapabilityInfo;
     tSirMacHTParametersInfo *pAmpduParamInfo;
-    tSirMacHTInfoField1         *pHTInfoField1;
 
     PELOG3(limLog(pMac, LOG3, FL("Handling CFG parameter id %X update\n"), cfgId);)
     switch (cfgId)
@@ -436,7 +339,7 @@
                    (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)))
             {
                 // Reactivate Background scan timer
-                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
+                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
                 if (tx_timer_activate(
                       &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
                 {
@@ -473,7 +376,7 @@
                 pMac->lim.limTimers.gLimPreAuthClnupTimer.sessionId = sessionId;
 #endif
                 // Reactivate pre-auth cleanup timer
-                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PRE_AUTH_CLEANUP_TIMER));
+                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_PRE_AUTH_CLEANUP_TIMER));
                 if (tx_timer_activate(&pMac->lim.limTimers.gLimPreAuthClnupTimer)
                                                        != TX_SUCCESS)
                 {
@@ -499,44 +402,6 @@
 
             break;
 
-    case WNI_CFG_CHANNEL_BONDING_MODE:
-         handleCBCFGChange( pMac, cfgId );
-         //for Secondary channel, change setupCBMode function OR the caller of that function during Join (STA) or Start BSS(AP/IBSS)
-         //Now update the HT Capability CFG based on Channel Bonding CFG
-         if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS) 
-            {
-                PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
-                break;
-            }
-        if (wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS) 
-            {
-                PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG\n"));)
-                break;
-            }
-        val16 = ( tANI_U16 ) val1;
-        pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
-
-        //channel bonding mode could be set to anything from 0 to 4(Titan had these modes)
-        //But for Taurus we have only two modes: enable(>0) or disable(=0)
-        pHTCapabilityInfo->supportedChannelWidthSet = val2 ? WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
-        if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
-            PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
-
-         if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS) 
-            {
-                PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG\n"));)
-                break;
-            }
-        val8 = ( tANI_U8 ) val1;
-        pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
-        pHTInfoField1->recommendedTxWidthSet = (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
-        pMac->lim.gHTRecommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
-        if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1) != eSIR_SUCCESS)
-            PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field\n"));)
-
-        break;
-
-
     case WNI_CFG_TRIG_STA_BK_SCAN:
         if(limUpdateTriggerStaBkScanFlag(pMac) != eSIR_SUCCESS)
         {
@@ -819,15 +684,14 @@
 
     limUpdateConfig(pMac,psessionEntry);
 
-    if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &val)
-            != eSIR_SUCCESS)
+    if (phyMode == WNI_CFG_PHY_MODE_11A)
     {
-        limLog(pMac, LOGP, FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
-        return;
+        // 11a mode always uses short slot
+        // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
+        psessionEntry->shortSlotTimeSupported = true;
     }
-    if (phyMode == WNI_CFG_PHY_MODE_11G)
+    else if (phyMode == WNI_CFG_PHY_MODE_11G)
     {
-
         if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
            (psessionEntry->pePersona == VOS_P2P_GO_MODE))
         {
@@ -842,22 +706,12 @@
         else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
             // Reassociating with AP.
             val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
-
- 
-        if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, val) != eSIR_SUCCESS)
-        {
-            limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
-            return;
-        }
+        psessionEntry->shortSlotTimeSupported = val;
     }
-    else
+    else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
     {
-        // Reset short slot time at CFG
-        if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, 0) != eSIR_SUCCESS)
-        {
-            limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
-            return;
-    }
+        // Will reach here in 11b case
+        psessionEntry->shortSlotTimeSupported = false;
     }
     //apply protection related config.
 
diff --git a/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c b/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
index 1147e90..79cfe66 100644
--- a/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
+++ b/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
@@ -110,7 +110,7 @@
 
     PELOGE(limLog(pMac, LOGE,
         FL("received Deauth frame (mlm state = %s) with reason code %d from "),
-        limMlmStateStr(pMac->lim.gLimMlmState), reasonCode);
+        limMlmStateStr(psessionEntry->limMlmState), reasonCode);
     limPrintMacAddr(pMac, pHdr->sa, LOGE);)
       
     if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE )||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
@@ -259,7 +259,7 @@
                         mlmDeauthInd.reasonCode = reasonCode;
 
                         psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
                         
                         limPostSmeMessage(pMac,
@@ -290,7 +290,7 @@
 
                         psessionEntry->limMlmState =
                                    psessionEntry->limPrevMlmState;
-                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, psessionEntry->limMlmState));
+                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
                         // Deactive Association response timeout
                         limDeactivateAndChangeTimer(
diff --git a/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c b/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
index 1e138a9..ff1697a 100644
--- a/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
+++ b/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
@@ -206,7 +206,7 @@
             case eSIR_MAC_DISASSOC_LEAVING_BSS_REASON:
                 // Valid reasonCode in received Disassociation frame
                 // as long as we're not about to channel switch
-                if(pMac->lim.gLimChannelSwitch.state != eLIM_CHANNEL_SWITCH_IDLE)
+                if(psessionEntry->gLimChannelSwitch.state != eLIM_CHANNEL_SWITCH_IDLE)
                 {
                     limLog(pMac, LOGW,
                         FL("Ignoring disassoc frame due to upcoming "
diff --git a/CORE/MAC/src/pe/lim/limProcessLmmMessages.c b/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
index 27c95ce..b95251e 100644
--- a/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
@@ -674,7 +674,7 @@
         pMac->lim.gLimSmeState = eLIM_SME_LINK_EST_WT_SCAN_STATE;
     else
         return;
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
 
     /* The commented piece of code here is to handle the Measurement Request from WSM as Scan
      * request in the LIM in Linux Station. Currently, the station uses Measurement request to 
@@ -686,7 +686,7 @@
     {
         pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
         pMac->lim.gLimMlmState     = eLIM_MLM_LEARN_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
         pMac->lim.gLimSystemInScanLearnMode = eANI_BOOLEAN_TRUE;
     }
 #if 0
diff --git a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
index a0d3ca7..1639fdb 100644
--- a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
+++ b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
@@ -98,8 +98,7 @@
 
 
 /* this function should not changed */
-  if((pMac->lim.gLimSmeState == eLIM_SME_SUSPEND_STATE) &&
-      (limMsg->type != SIR_LIM_RESUME_ACTIVITY_NTF))
+  if(pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
   {
       // Defer processsing this message
       if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
@@ -126,7 +125,6 @@
         (limMsg->type != WDA_SET_BSSKEY_RSP)&&
         (limMsg->type != WDA_SET_STAKEY_RSP)&&
         (limMsg->type != WDA_SET_STA_BCASTKEY_RSP) &&
-        (limMsg->type != SIR_LIM_RESUME_ACTIVITY_NTF)&&
         (limMsg->type != eWNI_SME_START_REQ) &&
         (limMsg->type != WDA_AGGR_QOS_RSP) &&
         (limMsg->type != WDA_REMOVE_BSSKEY_RSP) &&
@@ -145,6 +143,9 @@
 #ifdef WLAN_FEATURE_P2P 
         (limMsg->type != WDA_P2P_NOA_ATTR_IND) &&
 #endif
+#ifdef FEATURE_OEM_DATA_SUPPORT
+        (limMsg->type != WDA_START_OEM_DATA_RSP) &&
+#endif
         (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\n"),
@@ -301,11 +302,11 @@
 #endif
     if(retCode == TX_SUCCESS)
         {
-            MTRACE(macTraceMsgRx(pMac, 0, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
+            MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
         }
     else
         {
-            MTRACE(macTraceMsgRx(pMac, 0, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
+            MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
         }
 
 
@@ -658,7 +659,7 @@
         limSendSmeMgmtFrameInd( pMac, pHdr->fc.subType, (tANI_U8*)pHdr, 
                      WDA_GET_RX_PAYLOAD_LEN(pBd) + sizeof(tSirMacMgmtHdr), 
                      pLimMgmtRegistration->sessionId,
-                     WDA_GET_RX_CH(pBd) );
+                     WDA_GET_RX_CH(pBd), psessionEntry );
     
         if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
               && (subType == SIR_MAC_MGMT_RESERVED15) )
@@ -1082,6 +1083,61 @@
     }
 }
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+
+void limOemDataRspHandleResumeLinkRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* mlmOemDataRsp)
+{
+    if(status != eHAL_STATUS_SUCCESS)
+    {
+        limLog(pMac, LOGE, FL("OEM Data Rsp failed to get the response for resume link\n"));
+    }
+
+    if(NULL != pMac->lim.gpLimMlmOemDataReq)
+    {
+        palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmOemDataReq);
+        pMac->lim.gpLimMlmOemDataReq = NULL;
+    }
+
+    //"Failure" status doesn't mean that Oem Data Rsp did not happen
+    //and hence we need to respond to upper layers. Only Resume link is failed, but
+    //we got the oem data response already.
+    //Post the meessage to MLM
+    limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)(mlmOemDataRsp));
+
+    return;
+}
+
+void limProcessOemDataRsp(tpAniSirGlobal pMac, tANI_U32* body)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
+    tpStartOemDataRsp oemDataRsp = NULL;
+
+    //Process all the messages for the lim queue
+    SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+
+    oemDataRsp = (tpStartOemDataRsp)(body);
+
+    status = palAllocateMemory(pMac->hHdd, (void**)(&mlmOemDataRsp), sizeof(tLimMlmOemDataRsp));
+    if(status != eHAL_STATUS_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("could not allocate memory for mlmOemDataRsp\n"));
+        return;
+    }
+
+    //copy the memory into tLimMlmOemDataRsp and free the tStartOemDataRsp
+    //the structures tStartOemDataRsp and tLimMlmOemDataRsp have the same structure
+    palCopyMemory(pMac->hHdd, (void*)(mlmOemDataRsp), (void*)(oemDataRsp), sizeof(tLimMlmOemDataRsp));
+
+    //Now free the incoming memory
+    palFreeMemory(pMac->hHdd, (void*)(oemDataRsp));
+
+    limResumeLink(pMac, limOemDataRspHandleResumeLinkRsp, (tANI_U32*)mlmOemDataRsp);
+
+    return;
+}
+
+#endif
 
 
 /**
@@ -1120,6 +1176,8 @@
 #endif
     if(pMac->gDriverType == eDRIVER_TYPE_MFG)
     {
+        palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
+        limMsg->bodyptr = NULL;
         return;
     }
 #ifdef WLAN_DEBUG    
@@ -1131,61 +1189,15 @@
       limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
       limMlmStateStr(pMac->lim.gLimMlmState));)
 
-    MTRACE(macTraceMsgRx(pMac, 0, LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
+    MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
 
     switch (limMsg->type)
     {
-#if defined(ANI_DVT_DEBUG)
-        case SIR_LIM_SUSPEND_ACTIVITY_REQ:
-            // This message is from HAL notifying LIM
-            // to suspend activity. (PTT needs)
-            // Disable TFP & RHP
-            //halSetStaTxEnable(pMac, 1, eHAL_CLEAR);
-            //halStopDataTraffic(pMac);
-            //halSetRxEnable(pMac, eHAL_CLEAR);
-
-            pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
-            pMac->lim.gLimSmeState     = eLIM_SME_SUSPEND_STATE;
-         MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
-
-            // Post message back to HAL
-            msgQ.type = WDA_SUSPEND_ACTIVITY_RSP;
-            MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
-            wdaPostCtrlMsg(pMac, &msgQ);
-            break;
-#endif
 
         case SIR_LIM_UPDATE_BEACON:
             limUpdateBeacon(pMac);
             break;
 
-        case SIR_LIM_RESUME_ACTIVITY_NTF:
-            // This message is from HAL notifying LIM
-            // to resume activity.
-            if (pMac->lim.gLimSmeState == eLIM_SME_SUSPEND_STATE)
-            {
-                limLog(pMac, LOGE,
-                   FL("Received RESUME_NTF in State %s on Role %d\n"),
-                   limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSystemRole);
-                pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
-             MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
-
-                 handleCBCFGChange( pMac, ANI_IGNORE_CFG_ID );
-                 handleHTCapabilityandHTInfo(pMac);
-                 //initialize the TSPEC admission control table.
-                 limAdmitControlInit(pMac);
-                 limRegisterHalIndCallBack(pMac);
-            }
-            else
-            {
-                limLog(pMac, LOGE,
-                   FL("Received RESUME_NTF in inval State %X on Role %d\n"),
-                   pMac->lim.gLimSmeState, pMac->lim.gLimSystemRole);
-                limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
-            }
-
-            break;
-
         case SIR_CFG_PARAM_UPDATE_IND:
             /// CFG parameter updated
             if (limIsSystemInScanState(pMac))
@@ -1223,6 +1235,11 @@
         case WDA_FINISH_SCAN_RSP:
             limProcessFinishScanRsp(pMac, limMsg->bodyptr);
             break;
+#ifdef FEATURE_OEM_DATA_SUPPORT
+        case WDA_START_OEM_DATA_RSP:
+            limProcessOemDataRsp(pMac, limMsg->bodyptr);
+            break;
+#endif
 
         case WDA_SWITCH_CHANNEL_RSP:
             limProcessSwitchChannelRsp(pMac, limMsg->bodyptr);
@@ -1305,6 +1322,9 @@
         case eWNI_SME_STAT_SUMM_REQ:
         case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
         case eWNI_SME_GET_STATISTICS_REQ:
+#ifdef FEATURE_OEM_DATA_SUPPORT
+        case eWNI_SME_OEM_DATA_REQ:
+#endif
             // These messages are from HDD
             limProcessNormalHddMsg(pMac, limMsg, true);  //need to response to hdd
             break;
@@ -1389,28 +1409,6 @@
 
         case eWNI_PMC_SMPS_STATE_IND :
         {
-#ifdef SUPPORT_eWNI_PMC_SMPS_STATE_IND
-            tSirMbMsg *pMBMsg;
-            tSirMacHTMIMOPowerSaveState mimoPSstate;
-            /** Is System processing any SMPS Indication*/
-            if (!limIsSystemInSetMimopsState(pMac))
-            {
-                pMBMsg = (tSirMbMsg *)limMsg->bodyptr;
-                palCopyMemory(pMac->hHdd, &mimoPSstate, pMBMsg->data, sizeof(tSirMacHTMIMOPowerSaveState));
-                limSMPowerSaveStateInd(pMac, mimoPSstate);
-            }
-            else
-            {
-                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)\n"),
-                        limMsg->type, pMac->lim.gLimSmeState,  pMac->lim.gLimPrevSmeState,
-                        pMac->lim.gLimSystemRole,  pMac->lim.gLimMlmState,  pMac->lim.gLimPrevMlmState);)
-                    limLogSessionStates(pMac);
-                    limPrintMsgName(pMac, LOGE, limMsg->type);
-                }
-            }
-#endif
             if(limMsg->bodyptr){
             palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
             limMsg->bodyptr = NULL;
@@ -1480,7 +1478,10 @@
          * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT) 
          * for switching the channel*/
         case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
-            limProcessChannelSwitchTimeout(pMac);
+            if ( !tx_timer_running(&pMac->lim.limTimers.gLimChannelSwitchTimer) )
+            {  
+                limProcessChannelSwitchTimeout(pMac);
+            }
             palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
             limMsg->bodyptr = NULL;
             break;
@@ -2043,8 +2044,8 @@
     }
 
     /* limInsystemInscanState() refers the psessionEntry,  how to get session Entry????*/
-    if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) ||
-                (LIM_IS_RADAR_DETECTED(pMac))) && fDeferMsg)
+    if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) /*||
+                (LIM_IS_RADAR_DETECTED(pMac))*/) && fDeferMsg)
     {
         // System is in DFS (Learn) mode or awaiting addts response
         // or if radar is detected, Defer processsing this message
@@ -2085,7 +2086,7 @@
 }
 
 void
-handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac)
+handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry)
 {
     tSirMacHTCapabilityInfo macHTCapabilityInfo;
     tSirMacHTParametersInfo macHTParametersInfo;
@@ -2094,13 +2095,7 @@
     tSirMacHTInfoField3 macHTInfoField3;
     tANI_U32  cfgValue;
     tANI_U8 *ptr;
-    tpPESession psessionEntry = &pMac->lim.gpSession[0];//TBD-RAJESH HOW TO GET sessionEntry?????
 
-    pMac->lim.htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);  
-
-
-
-    // Get HT Capabilities
     if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
     {
         limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value\n"));
@@ -2114,7 +2109,6 @@
     pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
     pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
     pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
-    pMac->lim.gHTSupportedChannelWidthSet = (tANI_U8)macHTCapabilityInfo.supportedChannelWidthSet;
     pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
     pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
 
@@ -2139,8 +2133,6 @@
     pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
     pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
     pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
-    pMac->lim.gHTRecommendedTxWidthSet = (tANI_U8)macHTInfoField1.recommendedTxWidthSet;
-    pMac->lim.gHTSecondaryChannelOffset = (tSirMacHTSecondaryChannelOffset)macHTInfoField1.secondaryChannelOffset;
 
     if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
     {
@@ -2160,10 +2152,20 @@
     *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
     pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
     pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
-    psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
     pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
     pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
     pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
+
+    /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
+     * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
+     * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
+     * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
+     */
+    if (psessionEntry != NULL)
+    {
+        psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);  
+        psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
+    }
 }
 
 void limLogSessionStates(tpAniSirGlobal pMac)
diff --git a/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
index 10c27f1..91e6898 100644
--- a/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
@@ -61,6 +61,9 @@
 // MLM REQ processing function templates
 static void limProcessMlmStartReq(tpAniSirGlobal, tANI_U32 *);
 static void limProcessMlmScanReq(tpAniSirGlobal, tANI_U32 *);
+#ifdef FEATURE_OEM_DATA_SUPPORT
+static void limProcessMlmOemDataReq(tpAniSirGlobal, tANI_U32 *);
+#endif
 static void limProcessMlmJoinReq(tpAniSirGlobal, tANI_U32 *);
 static void limProcessMlmAuthReq(tpAniSirGlobal, tANI_U32 *);
 static void limProcessMlmAssocReq(tpAniSirGlobal, tANI_U32 *);
@@ -84,26 +87,7 @@
 
 static void limProcessMlmRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
 void 
-limSetChannel(tpAniSirGlobal pMac, tANI_U32 titanHtcap, tANI_U8 channel, tPowerdBm maxTxPower, tANI_U8 peSessionId);
-
-
-/*
- * determine the secondary channel state for hal
- */
-static ePhyChanBondState
-mlm_get_ext_chnl(
-    tpAniSirGlobal      pMac,
-    tAniCBSecondaryMode chnl)
-{
-    if (chnl == eANI_CB_SECONDARY_UP)
-        return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
-    if (chnl == eANI_CB_SECONDARY_DOWN)
-        return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-    return PHY_SINGLE_CHANNEL_CENTERED;
-
-}
-
-
+limSetChannel(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 secChannelOffset, tPowerdBm maxTxPower, tANI_U8 peSessionId);
 #define IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac)    (pMac->lim.gpLimMlmScanReq->backgroundScanMode == eSIR_AGGRESSIVE_BACKGROUND_SCAN)
 
 
@@ -141,6 +125,9 @@
     {
         case LIM_MLM_START_REQ:             limProcessMlmStartReq(pMac, Msg->bodyptr);   break;
         case LIM_MLM_SCAN_REQ:              limProcessMlmScanReq(pMac, Msg->bodyptr);    break;
+#ifdef FEATURE_OEM_DATA_SUPPORT
+        case LIM_MLM_OEM_DATA_REQ: limProcessMlmOemDataReq(pMac, Msg->bodyptr); break;
+#endif
         case LIM_MLM_JOIN_REQ:              limProcessMlmJoinReq(pMac, Msg->bodyptr);    break;
         case LIM_MLM_AUTH_REQ:              limProcessMlmAuthReq(pMac, Msg->bodyptr);    break;
         case LIM_MLM_ASSOC_REQ:             limProcessMlmAssocReq(pMac, Msg->bodyptr);   break;
@@ -352,7 +339,7 @@
     pMac->lim.gpchangeChannelData = cbdata;
 
     limSendSwitchChnlParams(pMac, newChannel,
-        eHT_SECONDARY_CHANNEL_OFFSET_NONE,
+        PHY_SINGLE_CHANNEL_CENTERED,
         psessionEntry->maxTxPower, psessionEntry->peSessionId);
 
     return;
@@ -451,7 +438,7 @@
             pMac->lim.limTimers.gLimMinChannelTimer.sessionId = sessionId;
 #endif            
             
-            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_MIN_CHANNEL_TIMER));
+            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MIN_CHANNEL_TIMER));
 
             if (tx_timer_activate(&pMac->lim.limTimers.gLimMinChannelTimer) != TX_SUCCESS)
             {
@@ -499,7 +486,7 @@
         PELOG2(limLog(pMac, LOG2, FL("START PASSIVE Scan chan %d\n"), channelNum);)
 
         /// Passive Scanning. Activate maxChannelTimer
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_MAX_CHANNEL_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
                                       != TX_SUCCESS)
         {
@@ -525,6 +512,8 @@
                 tANI_U32 val1 = 0;
 
                 val = SYS_MS_TO_TICKS(val);
+                //TODO: consider sessions.
+#if 0
 #ifdef ANI_PRODUCT_TYPE_CLIENT
                 // If a background was triggered via Quiet BSS,
                 // then we need to adjust the MIN and MAX channel
@@ -542,9 +531,10 @@
                     val1 = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
                 }
 #endif
+#endif
                 //Pick the longer stay time
                 val = (val > val1) ? val : val1;
-                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_MAX_CHANNEL_TIMER));
+                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)
                 {
@@ -716,53 +706,9 @@
         pInitScanParam->notifyHost = FALSE;
         pInitScanParam->scanMode = eHAL_SYS_MODE_LEARN;
 
-#if defined(ANI_AP_CLIENT_SDK) 
-        if (GET_LIM_SYSTEM_ROLE(pMac) == eLIM_STA_ROLE)
-        {
-            pInitScanParam->frameType = SIR_MAC_DATA_NULL;
-            // We need to inform the AP only when we are
-            // in the LINK_ESTABLISHED state
-            if( eLIM_SME_LINK_EST_WT_SCAN_STATE != pMac->lim.gLimSmeState )
-            {
-                pInitScanParam->notifyBss = FALSE;
-                // FIXME - Handle this one carefully
-                pInitScanParam->notifyHost = FALSE;
-            }
-            __limCreateInitScanRawFrame(pMac, pInitScanParam);
-            pInitScanParam->checkLinkTraffic = trafficCheck;
-        }
-        else
-#endif
-        {
-            pInitScanParam->frameType = SIR_MAC_CTRL_CTS;
-            __limCreateInitScanRawFrame(pMac, pInitScanParam);
-            pInitScanParam->checkLinkTraffic = trafficCheck;
-        }
-
-#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
-        /* Currently using the AP's scanDuration values for Linux station also. This should
-         * be revisited if this needs to changed depending on AP or Station */
-        {
-            if (pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity &&
-                    (pMac->lim.gLimMeasParams.shortDurationCount ==
-                     pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity))
-            {
-#ifdef ANI_AP_SDK
-                pInitScanParam->scanDuration = (tANI_U16)pMac->lim.gLimScanDurationConvert.longChannelScanDuration_tick;
-#else
-                pInitScanParam->scanDuration = (tANI_U16)pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration;
-#endif /* ANI_AP_SDK */
-            }
-            else
-            {
-#ifdef ANI_AP_SDK
-                pInitScanParam->scanDuration = pMac->lim.gLimScanDurationConvert.shortChannelScanDuration_tick;
-#else
-                pInitScanParam->scanDuration = (tANI_U16)pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration;
-#endif /* ANI_AP_SDK */
-            }
-        }
-#endif       //#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
+        pInitScanParam->frameType = SIR_MAC_CTRL_CTS;
+        __limCreateInitScanRawFrame(pMac, pInitScanParam);
+        pInitScanParam->checkLinkTraffic = trafficCheck;
     }
     else
     {
@@ -789,7 +735,7 @@
 
     pMac->lim.gLimHalScanState = nextState;
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
 
     rc = wdaPostCtrlMsg(pMac, &msg);
     if (rc == eSIR_SUCCESS) {
@@ -870,7 +816,7 @@
         pMac->lim.gLimHalScanState = nextState;
         SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
 
-        MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+        MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
         PELOGW(limLog(pMac, LOGW, FL("Channel %d\n"), channelNum);)
 
             rc = wdaPostCtrlMsg(pMac, &msg);
@@ -943,7 +889,7 @@
 
         pMac->lim.gLimHalScanState = nextState;
         SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-        MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+        MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
 
         rc = wdaPostCtrlMsg(pMac, &msg);
         if (rc == eSIR_SUCCESS) {
@@ -1036,9 +982,9 @@
     msg.type = WDA_FINISH_SCAN_REQ;
     msg.bodyptr = pFinishScanParam;
     msg.bodyval = 0;
-    pFinishScanParam->currentOperChannel = peGetResumeChannel(pMac);
-    //TODO: Fix CB State. Get it from session. similar to getChannel. 
-    pFinishScanParam->cbState = limGetPhyCBState( pMac );
+    
+    peGetResumeChannel(pMac, &pFinishScanParam->currentOperChannel, &pFinishScanParam->cbState);
+
     palZeroMemory( pMac->hHdd, (tANI_U8 *)&pFinishScanParam->macMgmtHdr, sizeof(tSirMacMgmtHdr));
 
     if (nextState == eLIM_HAL_FINISH_LEARN_WAIT_STATE)
@@ -1048,6 +994,7 @@
         pFinishScanParam->notifyBss = FALSE;
         pFinishScanParam->notifyHost = FALSE;
         pFinishScanParam->frameType = 0;
+
         pFinishScanParam->frameLength = 0;
         pMac->lim.gLimHalScanState = nextState;
     }
@@ -1073,7 +1020,7 @@
     }
 
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
 
     rc = wdaPostCtrlMsg(pMac, &msg);
     if (rc == eSIR_SUCCESS) {
@@ -1256,6 +1203,154 @@
     PELOG1(limLog(pMac, LOG1, FL("Scan ended, took %d tu\n"), (tx_time_get() - pMac->lim.scanStartTime));)
 } /*** limRestorePreScanState() ***/
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+
+void limSendHalOemDataReq(tpAniSirGlobal pMac)
+{
+    tSirMsgQ msg;
+    tpStartOemDataReq pStartOemDataReq = NULL;
+    tSirRetStatus rc = eSIR_SUCCESS;
+    tpLimMlmOemDataRsp pMlmOemDataRsp;
+    tANI_U32 reqLen = 0;
+    if(NULL == pMac->lim.gpLimMlmOemDataReq)
+    {
+        PELOGE(limLog(pMac, LOGE,  FL("Null pointer\n"));)
+        goto error;
+    }
+
+    reqLen = sizeof(tStartOemDataReq);
+
+    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)&pStartOemDataReq, reqLen))
+    {
+        PELOGE(limLog(pMac, LOGE,  FL("OEM_DATA: Could not allocate memory for pStartOemDataReq\n"));)
+        goto error;
+    }
+
+    palZeroMemory(pMac->hHdd, (tANI_U8*)(pStartOemDataReq), reqLen);
+
+    //Now copy over the information to the OEM DATA REQ to HAL
+    palCopyMemory(pMac->hHdd, pStartOemDataReq->selfMacAddr, pMac->lim.gpLimMlmOemDataReq->selfMacAddr, sizeof(tSirMacAddr));
+
+    palCopyMemory(pMac->hHdd, pStartOemDataReq->oemDataReq, pMac->lim.gpLimMlmOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE);
+
+    //Create the message to be passed to HAL
+    msg.type = WDA_START_OEM_DATA_REQ;
+    msg.bodyptr = pStartOemDataReq;
+    msg.bodyval = 0;
+
+    SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+
+    rc = wdaPostCtrlMsg(pMac, &msg);
+    if(rc == eSIR_SUCCESS)
+    {
+        return;
+    }
+
+    SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+    palFreeMemory(pMac->hHdd, (void*)pStartOemDataReq);
+    PELOGE(limLog(pMac, LOGE,  FL("OEM_DATA: posting WDA_START_OEM_DATA_REQ to HAL failed\n"));)
+
+error:
+    pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+
+    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)(&pMlmOemDataRsp), sizeof(tLimMlmOemDataRsp)))
+    {
+        limLog(pMac->hHdd, LOGP, FL("OEM_DATA: memory allocation for pMlmOemDataRsp failed under suspend link failure\n"));
+        return;
+    }
+
+    if(NULL != pMac->lim.gpLimMlmOemDataReq)
+    {
+        palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmOemDataReq);
+        pMac->lim.gpLimMlmOemDataReq = NULL;
+    }
+
+    limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)pMlmOemDataRsp);
+
+    return;
+}
+/**
+ * limSetOemDataReqModeFailed()
+ *
+ * FUNCTION:
+ *  This function is used as callback to resume link after the suspend fails while
+ *  starting oem data req mode.
+ * LOGIC:
+ *  NA
+ *
+ * ASSUMPTIONS:
+ *  NA
+ *
+ * NOTE:
+ *
+ * @param pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void limSetOemDataReqModeFailed(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* data)
+{
+    tpLimMlmOemDataRsp pMlmOemDataRsp;
+
+    pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+
+    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)(&pMlmOemDataRsp), sizeof(tLimMlmOemDataRsp)))
+    {
+        limLog(pMac->hHdd, LOGP, FL("OEM_DATA: memory allocation for pMlmOemDataRsp failed under suspend link failure\n"));
+        return;
+    }
+
+    if(NULL != pMac->lim.gpLimMlmOemDataReq)
+    {
+        palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmOemDataReq);
+        pMac->lim.gpLimMlmOemDataReq = NULL;
+    }
+
+    palZeroMemory(pMac->hHdd, pMlmOemDataRsp, sizeof(tLimMlmOemDataRsp));
+
+    limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)pMlmOemDataRsp);
+
+    return;
+}
+
+/**
+ * limSetOemDataReqMode()
+ *
+ *FUNCTION:
+ * This function is called to setup system into OEM DATA REQ mode
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param  pMac - Pointer to Global MAC structure
+ * @return None
+ */
+
+void limSetOemDataReqMode(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* data)
+{
+    if(status != eHAL_STATUS_SUCCESS)
+    {
+        limLog(pMac, LOGE, FL("OEM_DATA: failed in suspend link\n"));
+        goto error;
+    }
+    else
+    {
+        PELOGE(limLog(pMac, LOGE, FL("OEM_DATA: Calling limSendHalOemDataReq\n"));)
+        limSendHalOemDataReq(pMac);
+        return;
+    }
+
+error:
+    limResumeLink(pMac, limSetOemDataReqModeFailed, NULL);
+    return ;
+} /*** end limSendHalOemDataReq() ***/
+
+#endif //FEATURE_OEM_DATA_SUPPORT
 
 static void
 mlm_add_sta(
@@ -1323,8 +1418,17 @@
 
 #endif
     }
-
+#ifdef WLAN_FEATURE_11AC
+    if (psessionEntry->vhtCapability)
+    {
+        pSta->vhtCapable = VOS_TRUE;
+    }
+#endif
+#ifdef WLAN_FEATURE_11AC
+    limPopulateOwnRateSet(pMac, &pSta->supportedRates, NULL, false,psessionEntry,NULL);
+#else
     limPopulateOwnRateSet(pMac, &pSta->supportedRates, NULL, false,psessionEntry);
+#endif
     limFillSupportedRatesInfo(pMac, NULL, &pSta->supportedRates,psessionEntry);
     
     limLog( pMac, LOGE, FL( "GF: %d, ChnlWidth: %d, MimoPS: %d, lsigTXOP: %d, dsssCCK: %d, SGI20: %d, SGI40%d\n") ,
@@ -1361,10 +1465,6 @@
     tpAddBssParams pAddBssParams = NULL;
     tANI_U32 retCode;
 
-#ifdef WLAN_SOFTAP_FEATURE
-    tANI_U32 val = 0;
-#endif
-    
     // Package WDA_ADD_BSS_REQ message parameters
 
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
@@ -1401,16 +1501,9 @@
     }
 
 #ifdef WLAN_SOFTAP_FEATURE  
-    if( wlan_cfgGetInt ( pMac, WNI_CFG_SHORT_SLOT_TIME, &val ) != eSIR_SUCCESS)
-    {
-        limLog ( pMac, LOGP, FL(" Error : unable to fetch the WNI_CFG_SHORT_SLOT_TIME\n"));
-        palFreeMemory(pMac->hHdd,(void *)pAddBssParams);
-        return eSIR_SME_HAL_SEND_MESSAGE_FAIL;
-    }
-    pAddBssParams->shortSlotTimeSupported = (tANI_U8)val;
+    pAddBssParams->shortSlotTimeSupported = psessionEntry->shortSlotTimeSupported;
 #endif
 
-
     pAddBssParams->beaconInterval               = pMlmStartReq->beaconPeriod;
     pAddBssParams->dtimPeriod                   = pMlmStartReq->dtimPeriod;
     pAddBssParams->cfParamSet.cfpCount          = pMlmStartReq->cfParamSet.cfpCount;
@@ -1425,12 +1518,16 @@
     pAddBssParams->nwType = pMlmStartReq->nwType;
 
     pAddBssParams->htCapable            = pMlmStartReq->htCapable;
+#ifdef WLAN_FEATURE_11AC
+    pAddBssParams->vhtCapable           = psessionEntry->vhtCapability;
+    pAddBssParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet; 
+#endif
     pAddBssParams->htOperMode           = pMlmStartReq->htOperMode;
     pAddBssParams->dualCTSProtection    = pMlmStartReq->dualCTSProtection;
     pAddBssParams->txChannelWidthSet    = pMlmStartReq->txChannelWidthSet;
 
     pAddBssParams->currentOperChannel   = pMlmStartReq->channelNumber;
-    pAddBssParams->currentExtChannel    = mlm_get_ext_chnl(pMac, pMlmStartReq->cbMode);
+    pAddBssParams->currentExtChannel    = pMlmStartReq->cbMode;
 
     /* Update PE sessionId*/
     pAddBssParams->sessionId            = pMlmStartReq->sessionId; 
@@ -1459,7 +1556,7 @@
 
     // Set a new state for MLME
     psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
     pAddBssParams->halPersona=psessionEntry->pePersona; //pass on the session persona to hal
 
@@ -1478,7 +1575,7 @@
     msgQ.reserved   = 0;
     msgQ.bodyptr    = pAddBssParams;
     msgQ.bodyval    = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
     limLog( pMac, LOGW, FL( "Sending WDA_ADD_BSS_REQ...\n" ));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
@@ -1718,6 +1815,7 @@
     {
         PELOGE(limLog(pMac, LOGE,
                FL("Sending START_SCAN from LIM while one req is pending\n"));)
+        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf);
         return;
     }
 
@@ -1737,7 +1835,7 @@
             pMac->lim.gLimMlmState = eLIM_MLM_WT_PROBE_RESP_STATE;
         else // eSIR_PASSIVE_SCAN
             pMac->lim.gLimMlmState = eLIM_MLM_PASSIVE_SCAN_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
 
         pMac->lim.gLimSystemInScanLearnMode = 1;
 
@@ -1775,6 +1873,57 @@
     }
 } /*** limProcessMlmScanReq() ***/
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+static void limProcessMlmOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+    tLimMlmOemDataRsp*     pMlmOemDataRsp;
+    
+    if (((pMac->lim.gLimMlmState == eLIM_MLM_IDLE_STATE) ||
+         (pMac->lim.gLimMlmState == eLIM_MLM_JOINED_STATE) ||
+         (pMac->lim.gLimMlmState == eLIM_MLM_AUTHENTICATED_STATE) ||
+         (pMac->lim.gLimMlmState == eLIM_MLM_BSS_STARTED_STATE) ||
+         (pMac->lim.gLimMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)))
+    {
+        //Hold onto the oem data request criteria
+        pMac->lim.gpLimMlmOemDataReq = (tLimMlmOemDataReq*)pMsgBuf;
+
+        pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
+
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
+
+        //Now request for link suspension
+        limSuspendLink(pMac, eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN, limSetOemDataReqMode, NULL);
+    }
+    else
+    {
+        /**
+         * Should not have received oem data req in other states
+         * Log error
+         */
+
+        PELOGW(limLog(pMac, LOGW, FL("OEM_DATA: unexpected LIM_MLM_OEM_DATA_REQ in invalid state %X\n"),pMac->lim.gLimMlmState);)
+
+        limPrintMlmState(pMac, LOGW, pMac->lim.gLimMlmState);
+
+        /// Free up buffer allocated
+        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf);
+
+        /// Return Meas confirm with INVALID_PARAMETERS
+        if(eHAL_STATUS_SUCCESS == palAllocateMemory(pMac->hHdd, (void**)&pMlmOemDataRsp, sizeof(tLimMlmOemDataRsp)))
+        {
+            limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)pMlmOemDataRsp);
+            palFreeMemory(pMac->hHdd, pMlmOemDataRsp);
+        }
+        else
+        {
+            limLog(pMac, LOGP, FL("Could not allocate memory for pMlmOemDataRsp\n"));
+            return;
+        }
+    }
+
+    return;
+}
+#endif //FEATURE_OEM_DATA_SUPPORT
 
 
 /**
@@ -1803,7 +1952,7 @@
 static void
 limProcessMlmPostJoinSuspendLink(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *ctx)
 {
-    tANI_U8             chanNum;
+    tANI_U8             chanNum, secChanOffset;
     tLimMlmJoinCnf      mlmJoinCnf;
     tpPESession         psessionEntry = (tpPESession)ctx;
     tSirLinkState       linkState;
@@ -1815,7 +1964,7 @@
     }
     psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
     psessionEntry->limMlmState = eLIM_MLM_WT_JOIN_BEACON_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
     limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
 
@@ -1831,7 +1980,8 @@
     {
         limLog(pMac, LOGE, FL("limSetLinkState to eSIR_LINK_PREASSOC_STATE Failed!!\n"));
         mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-        pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
+        psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
         goto error;
     }
 
@@ -1839,11 +1989,11 @@
     // chanNum = pMac->lim.gpLimMlmJoinReq->bssDescription.channelId;
     
     chanNum = psessionEntry->currentOperChannel;
+    secChanOffset = psessionEntry->htSecondaryChannelOffset;
     //store the channel switch sessionEntry in the lim global var
     psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_JOIN;
 
-    limSetChannel(pMac, psessionEntry->pLimMlmJoinReq->bssDescription.titanHtCaps,
-                        chanNum, psessionEntry->maxTxPower, psessionEntry->peSessionId); 
+    limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId); 
 
     return;
 error:
@@ -1949,7 +2099,7 @@
         limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
         
         limLog(pMac, LOGE, FL("Unexpected Join request for role %d state %X\n"),
-               psessionEntry->limSystemRole, pMac->lim.gLimMlmState);
+               psessionEntry->limSystemRole, psessionEntry->limMlmState);
     }
 
 error: 
@@ -2115,28 +2265,9 @@
             limDeletePreAuthNode(pMac,
                                  pMac->lim.gpLimMlmAuthReq->peerMacAddr);
 
-        //assign appropriate sessionId to the timer object
-        pMac->lim.limTimers.gLimAuthFailureTimer.sessionId = sessionId;
-        
-        // Activate Auth failure timer
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_AUTH_FAIL_TIMER));
-        if (tx_timer_activate(&pMac->lim.limTimers.gLimAuthFailureTimer)
-                                       != TX_SUCCESS)
-        {
-            /// Could not start Auth failure timer.
-            // Log error
-            limLog(pMac, LOGP,
-                   FL("could not start Auth failure timer\n"));
-
-            /// Return Auth confirm with Resources Unavailable
-            mlmAuthCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-
-            goto end;
-        }
-
         psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
         psessionEntry->limMlmState = eLIM_MLM_WT_AUTH_FRAME2_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
         /// Prepare & send Authentication frame
         authFrameBody.authAlgoNumber =
@@ -2148,6 +2279,22 @@
                              pMac->lim.gpLimMlmAuthReq->peerMacAddr,
                              LIM_NO_WEP_IN_FC,psessionEntry);
 
+        //assign appropriate sessionId to the timer object
+        pMac->lim.limTimers.gLimAuthFailureTimer.sessionId = sessionId;
+ 
+        // 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)
+                                       != TX_SUCCESS)
+        {
+            /// Could not start Auth failure timer.
+            // Log error
+            limLog(pMac, LOGP,
+                   FL("could not start Auth failure timer\n"));
+            // Cleanup as if auth timer expired
+            limProcessAuthFailureTimeout(pMac);
+        }
+
         return;
     }
     else
@@ -2215,6 +2362,7 @@
     if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmAssocReq->sessionId) )== NULL) 
     {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmAssocReq);
         return;
     }
 
@@ -2232,31 +2380,13 @@
          (psessionEntry->limMlmState == eLIM_MLM_AUTHENTICATED_STATE || psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE) &&
          (palEqualMemory(pMac->hHdd,pMlmAssocReq->peerMacAddr, currentBssId, sizeof(tSirMacAddr))) )
     {
+
         /// map the session entry pointer to the AssocFailureTimer 
         pMac->lim.limTimers.gLimAssocFailureTimer.sessionId = pMlmAssocReq->sessionId;
 
-
-        /// Start association failure timer
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_ASSOC_FAIL_TIMER));
-        if (tx_timer_activate(&pMac->lim.limTimers.gLimAssocFailureTimer)
-                                              != TX_SUCCESS)
-        {
-            /// Could not start Assoc failure timer.
-            // Log error
-            limLog(pMac, LOGP,
-                   FL("could not start Association failure timer\n"));
-
-            /// Return Assoc confirm with Resources Unavailable
-
-            mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-            mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
-
-            goto end;
-        }
-
         psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
         psessionEntry->limMlmState = eLIM_MLM_WT_ASSOC_RSP_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
  
         /// Prepare and send Association request frame
         limSendAssocReqMgmtFrame(pMac, pMlmAssocReq,psessionEntry);
@@ -2273,6 +2403,19 @@
            psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
             PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState\n"));)
     }
+        /// Start association failure timer
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ASSOC_FAIL_TIMER));
+        if (tx_timer_activate(&pMac->lim.limTimers.gLimAssocFailureTimer)
+                                              != TX_SUCCESS)
+        {
+            /// Could not start Assoc failure timer.
+            // Log error
+            limLog(pMac, LOGP,
+                   FL("could not start Association failure timer\n"));
+            // Cleanup as if assoc timer expired
+            limProcessAssocFailureTimeout(pMac,LIM_ASSOC );
+           
+        }
 
         return;
     }
@@ -2332,7 +2475,7 @@
 static void
 limProcessMlmReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
-    tANI_U8                       chanNum;
+    tANI_U8                       chanNum, secChannelOffset;
     struct tLimPreAuthNode  *pAuthNode;
     tLimMlmReassocReq       *pMlmReassocReq;
     tLimMlmReassocCnf       mlmReassocCnf;
@@ -2349,6 +2492,7 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pMlmReassocReq->sessionId)) == NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("Session Does not exist for given sessionId\n"));)
+        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
         return;
     }
     
@@ -2385,7 +2529,7 @@
 
         psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
         psessionEntry->limMlmState    = eLIM_MLM_WT_REASSOC_RSP_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
 #if 0
         // Update BSSID at CFG database
@@ -2407,7 +2551,7 @@
          */
 
         chanNum = psessionEntry->limReassocChannelId;
-
+        secChannelOffset = psessionEntry->reAssocHtSecondaryChannelOffset;
 
         /* To Support BT-AMP .. read channel number from psessionEntry*/
         //chanNum = psessionEntry->currentOperChannel;
@@ -2420,8 +2564,8 @@
         //psessionEntry->pLimReAssocReq = (void *)pMlmReassocReq;
         psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_REASSOC;
 
-        /** Switch channell to the new Operating channel for Reassoc*/
-        limSetChannel(pMac, psessionEntry->limReassocTitanHtCaps, chanNum, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+        /** Switch channel to the new Operating channel for Reassoc*/
+        limSetChannel(pMac, chanNum, secChannelOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
 
         return;
     }
@@ -2571,7 +2715,7 @@
     pStaDs->mlmStaContext.cleanupTrigger = pMlmDisassocReq->disassocTrigger;
 
     /// Send Disassociate frame to peer entity
-    if (sendDisassocFrame)
+    if (sendDisassocFrame && (pMlmDisassocReq->reasonCode != eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON))
     {
     limSendDisassocMgmtFrame(pMac,
                              pMlmDisassocReq->reasonCode,
@@ -2582,13 +2726,6 @@
        sendDisassocFrame = 1;    
     }
 
-    if (psessionEntry->limSystemRole == eLIM_AP_ROLE) 
-    {
-       //SAP mode delay DEL STA for 300ms such that disassoc can be delivered at TIM
-       //100 ms for normal TIM and 300 ms for dynamic TIM
-       vos_sleep(300); 
-    }
-
     /// Receive path cleanup with dummy packet
     if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs,psessionEntry))
         {
@@ -2678,7 +2815,8 @@
         return;
     }
 
-    if( isLimSessionOffChannel(pMac, pMlmDisassocReq->sessionId) )
+    if( (psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
+        isLimSessionOffChannel(pMac, pMlmDisassocReq->sessionId) )
     {
       //suspend link
       limSuspendLink(pMac, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN, 
@@ -2720,6 +2858,7 @@
     {
     
         PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId\n"));)
+        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
         return;
     }
     #if 0
@@ -2782,7 +2921,7 @@
                         /// Prepare and Send LIM_MLM_DEAUTH_CNF
                         mlmDeauthCnf.resultCode = eSIR_SME_SUCCESS;
                         psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
                         goto end;
                     }
                     else
@@ -2812,6 +2951,7 @@
             break;
 
         case eLIM_STA_IN_IBSS_ROLE:
+            palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
 
             return;
 
@@ -2890,14 +3030,6 @@
     limSendDeauthMgmtFrame(pMac, pMlmDeauthReq->reasonCode,
                            pMlmDeauthReq->peerMacAddr,psessionEntry);
 
-    if( (psessionEntry->limSystemRole == eLIM_AP_ROLE))
-    {
-      // Delay DEL STA for 300ms such that unicast deauth is 
-      // delivered at TIM(100 for normal or 300ms for dynamic) 
-      // to power save stations after setting PVB
-      vos_sleep(300);
-    }
-
     /// Receive path cleanup with dummy packet
     limCleanupRxPath(pMac, pStaDs,psessionEntry);
 
@@ -2968,7 +3100,8 @@
         return;
     }
 
-    if( isLimSessionOffChannel(pMac, pMlmDeauthReq->sessionId) )
+    if( (psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
+        isLimSessionOffChannel(pMac, pMlmDeauthReq->sessionId) )
     {
       //suspend link
       limSuspendLink(pMac, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN, 
@@ -3125,15 +3258,23 @@
   }
 
     if ((pMlmSetKeysReq->numKeys == 0) && (pMlmSetKeysReq->edType != eSIR_ED_NONE)) {
-    //
-    // Broadcast/Multicast Keys (for WEP!!) are NOT sent
-    // via this interface!!
-    //
-    // This indicates to HAL that the WEP Keys need to be
-    // extracted from the CFG and applied to hardware
-    defaultKeyId = 0xff;
-      }else
-    defaultKeyId = 0;
+        //
+        // Broadcast/Multicast Keys (for WEP!!) are NOT sent
+        // via this interface!!
+        //
+        // This indicates to HAL that the WEP Keys need to be
+        // extracted from the CFG and applied to hardware
+        defaultKeyId = 0xff;
+    }else if(pMlmSetKeysReq->key[0].keyId && 
+             ((pMlmSetKeysReq->edType == eSIR_ED_WEP40) || 
+              (pMlmSetKeysReq->edType == eSIR_ED_WEP104))){
+        /* If the Key Id is non zero and encryption mode is WEP, 
+         * the key index is coming from the upper layers so that key only 
+         * need to be used as the default tx key, This is being used only 
+         * in case of WEP mode in HAL */
+        defaultKeyId = pMlmSetKeysReq->key[0].keyId;
+    }else
+        defaultKeyId = 0;
 
     limLog( pMac, LOG1,
       FL( "Trying to set keys for STA Index [%d], using defaultKeyId [%d]\n" ),
@@ -3143,7 +3284,7 @@
     if(limIsAddrBC( pMlmSetKeysReq->peerMacAddr )) {
   psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
   psessionEntry->limMlmState = eLIM_MLM_WT_SET_BSS_KEY_STATE;
-  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
         limLog( pMac, LOG1, FL("Trying to set Group Keys...%d \n"), 
             psessionEntry->peSessionId);
 
@@ -3204,6 +3345,7 @@
     {
         PELOGE(limLog(pMac, LOGE,
                     FL("session does not exist for given sessionId\n"));)
+        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
         return;
     }
 
@@ -3256,7 +3398,7 @@
     if(limIsAddrBC( pMlmRemoveKeyReq->peerMacAddr )) //Second condition for IBSS or AP role.
     {
         psessionEntry->limMlmState = eLIM_MLM_WT_REMOVE_BSS_KEY_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));    
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));    
         // Package WDA_REMOVE_BSSKEY_REQ message parameters
         limSendRemoveBssKeyReq( pMac,pMlmRemoveKeyReq,psessionEntry);
         return;
@@ -3294,7 +3436,7 @@
 
 
     psessionEntry->limMlmState = eLIM_MLM_WT_REMOVE_STA_KEY_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
     // Package WDA_REMOVE_STAKEY_REQ message parameters
     limSendRemoveStaKeyReq( pMac,pMlmRemoveKeyReq,staIdx,psessionEntry);
@@ -3302,6 +3444,7 @@
  
 end:
     limPostSmeRemoveKeyCnf( pMac,
+      psessionEntry,
       pMlmRemoveKeyReq,
       &mlmRemoveKeyCnf );
 
@@ -3605,7 +3748,7 @@
         mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
 
         psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
         if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId, 
             psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
             PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState\n"));)
@@ -3863,13 +4006,8 @@
             PELOGE(limLog(pMac, LOGE,  FL("(Re)Assoc Failure Timeout occurred.\n"));)
 
             psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, psessionEntry->limMlmState));
-            
-            //Set the RXP mode to IDLE, so it starts filtering the frames.
-            if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId, 
-                psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
-                PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState\n"));)
-         
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+
             // 'Change' timer for future activations
             limDeactivateAndChangeTimer(pMac, eLIM_ASSOC_FAIL_TIMER);
 
@@ -3916,7 +4054,7 @@
              * Set BSSID to currently associated AP address.
              */
             psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
             limRestorePreReassocState(pMac, 
                 eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry);
@@ -3951,7 +4089,7 @@
 
     /// Restore previous MLM state
     pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
     limRestorePreScanState(pMac);
 
     // Free up pMac->lim.gLimMlmScanReq
@@ -3998,6 +4136,7 @@
   {
       PELOGE(limLog(pMac, LOGE,
                FL("session does not exist for given sessionId\n"));)
+      palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
       return;
   }
   
@@ -4048,7 +4187,7 @@
 
     // Restore MLME state
     psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
   }
 
@@ -4090,6 +4229,7 @@
     {
         PELOGE(limLog(pMac, LOGE,
                   FL("session does not exist for given session ID\n"));)
+        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
         return;
     }
   
@@ -4151,6 +4291,7 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDelBAReq->sessionId))== NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));)
+        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
         return;
     }
 
@@ -4319,49 +4460,93 @@
 return eSIR_SUCCESS;
 }
 
+#ifdef WLAN_FEATURE_11AC
+ePhyChanBondState limGet11ACPhyCBState(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 htSecondaryChannelOffset )
+{
+    ePhyChanBondState cbState = PHY_SINGLE_CHANNEL_CENTERED;
+
+    if(!pMac->lim.apChanWidth)
+    {
+        return htSecondaryChannelOffset;
+    }
+
+    if ( (htSecondaryChannelOffset 
+                 == PHY_DOUBLE_CHANNEL_LOW_PRIMARY)
+       )
+    {
+        if ((channel + 2 ) == pMac->lim.apCenterChan )
+            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED;
+        else if ((channel + 6 ) == pMac->lim.apCenterChan )
+            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
+        else if ((channel - 2 ) == pMac->lim.apCenterChan )
+            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
+        else 
+            limLog (pMac, LOGP, 
+                       FL("Invalid Channel Number = %d Center Chan = %d \n"), 
+                                 channel, pMac->lim.apCenterChan);
+    }
+    if ( (htSecondaryChannelOffset 
+                 == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)
+       )
+    {
+        if ((channel - 2 ) == pMac->lim.apCenterChan )
+            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED;
+        else if ((channel + 2 ) == pMac->lim.apCenterChan )
+            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
+        else if ((channel - 6 ) == pMac->lim.apCenterChan )
+            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
+        else 
+           limLog (pMac, LOGP, 
+                         FL("Invalid Channel Number = %d Center Chan = %d \n"),
+                                            channel, pMac->lim.apCenterChan);
+    }
+    return cbState;
+}
+
+#endif
+
 void 
-limSetChannel(tpAniSirGlobal pMac, tANI_U32 titanHtcap, tANI_U8 channel, tPowerdBm maxTxPower, tANI_U8 peSessionId)
+limSetChannel(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 secChannelOffset, tPowerdBm maxTxPower, tANI_U8 peSessionId)
 {
 #if !defined WLAN_FEATURE_VOWIFI
     tANI_U32 localPwrConstraint;
 #endif
+    tpPESession peSession;
 
-    // Setup the CB State appropriately, prior to
-    // issuing a dphChannelChange(). This is done
-    // so that if CB is enabled, the CB Secondary
-    // Channel is setup correctly
-    
-     /* if local CB admin state is off or join req CB admin state is off, don't bother with CB channel setup */
-    PELOG1(limLog(pMac, LOG1, FL("Before : gCbState = 0x%x, gCbmode = %x\n"), pMac->lim.gCbState, pMac->lim.gCbMode);)
-    if(GET_CB_ADMIN_STATE(pMac->lim.gCbState) &&
-                    SME_GET_CB_ADMIN_STATE(titanHtcap)) {
-        PELOG1(limLog(pMac, LOG1, FL("station doing channel bonding\n"));)
-        setupCBState( pMac, (tAniCBSecondaryMode)SME_GET_CB_OPER_STATE(titanHtcap));
-    }else {
-        PELOG1(limLog(pMac, LOG1, FL("station not doing channel bonding\n"));)
-        setupCBState(pMac, eANI_CB_SECONDARY_NONE);
+    peSession = peFindSessionBySessionId (pMac, peSessionId);
+
+    if ( NULL == peSession)
+    {
+       limLog (pMac, LOGP, FL("Invalid PE session = %d\n"), peSessionId);
+       return;
     }
-
-    PELOG1(limLog(pMac, LOG1, FL("After :gCbState = 0x%x, gCbmode = %x\n"), pMac->lim.gCbState, pMac->lim.gCbMode);)
-
-    #if 0
-    if (wlan_cfgSetInt(pMac, WNI_CFG_CURRENT_CHANNEL, channel) != eSIR_SUCCESS) {
-           limLog(pMac, LOGP, FL("could not set CURRENT_CHANNEL at CFG\n"));
-           return;
-    }
-    #endif // TO SUPPORT BT-AMP
-
 #if defined WLAN_FEATURE_VOWIFI  
-    limSendSwitchChnlParams( pMac, channel, limGetPhyCBState( pMac ), maxTxPower, peSessionId);
+#ifdef WLAN_FEATURE_11AC
+    if ( peSession->vhtCapability )
+    {
+        limSendSwitchChnlParams( pMac, channel, limGet11ACPhyCBState( pMac,channel,secChannelOffset ), maxTxPower, peSessionId);
+    }
+    else
+#endif
+    {
+        limSendSwitchChnlParams( pMac, channel, secChannelOffset, maxTxPower, peSessionId);
+    }
 #else
     if (wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
            limLog(pMac, LOGP, FL("could not read WNI_CFG_LOCAL_POWER_CONSTRAINT from CFG\n"));
            return;
     }
     // Send WDA_CHNL_SWITCH_IND to HAL
-    limSendSwitchChnlParams( pMac, channel, limGetPhyCBState( pMac ), (tPowerdBm)localPwrConstraint, peSessionId);
+#ifdef WLAN_FEATURE_11AC
+    if ( peSession->vhtCapability && pMac->lim.vhtCapabilityPresentInBeacon)
+    {
+        limSendSwitchChnlParams( pMac, channel, limGet11ACPhyCBState( pMac,channel,secChannelOffset ), maxTxPower, peSessionId);
+    }
+    else
 #endif
-   
+    {
+        limSendSwitchChnlParams( pMac, channel, secChannelOffset, (tPowerdBm)localPwrConstraint, peSessionId);
+    }
+#endif
+
  }
-
-
diff --git a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
index 8bd6a01..f3256a8 100644
--- a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
@@ -50,15 +50,21 @@
 #include "limSendMessages.h"
 #include "limIbssPeerMgmt.h"
 #include "limSession.h"
+#include "limSessionUtils.h"
 #if defined WLAN_FEATURE_VOWIFI
 #include "rrmApi.h"
 #endif
 #if defined WLAN_FEATURE_VOWIFI_11R
 #include <limFT.h>
 #endif
+#include "wlan_qct_wda.h"
 
 static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
+static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
 void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
+#ifdef FEATURE_OEM_DATA_SUPPORT
+void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *);
+#endif
 void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *);
 void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *);
 void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *);
@@ -114,6 +120,11 @@
             limProcessMlmScanCnf(pMac, pMsgBuf);
             break;
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+        case LIM_MLM_OEM_DATA_CNF:
+            limProcessMlmOemDataReqCnf(pMac, pMsgBuf);
+            break;
+#endif
 
         case LIM_MLM_AUTH_CNF:
             limProcessMlmAuthCnf(pMac, pMsgBuf);
@@ -201,7 +212,7 @@
         //case eLIM_SME_LINK_EST_WT_SCAN_STATE:  //TO SUPPORT BT-AMP
         //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:   //TO SUPPORT BT-AMP
             pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
             pMac->lim.gLimSystemInScanLearnMode = 0;
             break;
         default:
@@ -270,6 +281,43 @@
     }
 } /*** end limProcessMlmScanCnf() ***/
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+
+/**
+ * limProcessMlmOemDataReqCnf()
+ *
+ *FUNCTION:
+ * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF
+ * message from MLM State machine.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param pMac       Pointer to Global MAC structure
+ * @param pMsgBuf    A pointer to the MLM message buffer
+ *
+ * @return None
+ */
+
+void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+    tLimMlmOemDataRsp*    measRsp;
+
+    tSirResultCodes resultCode = eSIR_SME_SUCCESS;
+
+    measRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
+
+    //Now send the meas confirm message to the sme
+    limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode);
+
+    //Dont free the memory here. It will be freed up by the callee
+
+    return;
+}
+#endif
 
 /**
  * limProcessMlmStartCnf()
@@ -333,7 +381,7 @@
          * Beacon file register.
          */
         psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
         if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
         {
              limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***\n"));
@@ -427,7 +475,7 @@
     {
         /// Join failure
         psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
         /// Send Join response to Host
         limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
     }
@@ -562,12 +610,10 @@
             {
                 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred.\n"));)
                 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
                 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
-                if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
-                    psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
-                   PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState.\n"));)
+                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+
 #if defined(ANI_AP_CLIENT_SDK)
                 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
                 {
@@ -594,7 +640,7 @@
                  * Send Pre-auth failure response to host
                  */
                 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
-                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
                 limSendSmeAuthRsp(
                             pMac,
                             ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
@@ -661,9 +707,10 @@
 
             pMlmAssocReq->capabilityInfo = caps;
            PELOG3(limLog(pMac, LOG3,
-               FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x\n"),
+               FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x\n"),
                caps,
-               ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy);)
+               ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
+               ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
 
            /* If telescopic beaconing is enabled, set listen interval to
               WNI_CFG_TELE_BCN_MAX_LI */
@@ -702,7 +749,7 @@
             pMlmAssocReq->sessionId = psessionEntry->peSessionId;
             psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
             psessionEntry->limSmeState     = eLIM_SME_WT_ASSOC_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
             limPostMlmMessage(pMac,
                               LIM_MLM_ASSOC_REQ,
                               (tANI_U32 *) pMlmAssocReq);
@@ -714,7 +761,7 @@
              * Send Pre-auth response to host
              */
             psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
             limSendSmeAuthRsp(
                         pMac,
                         ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
@@ -778,7 +825,7 @@
         // Association failure
         PELOG1(limLog(pMac, LOG1, FL("*** Association failure ***\n"));)
         psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
 #if defined(ANI_AP_CLIENT_SDK)
         if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
         {
@@ -803,7 +850,7 @@
         // Successful Association
         PELOG1(limLog(pMac, LOG1, FL("*** Associated with BSS ***\n"));)
         psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
         /**
          * Need to send Join response with
          * Association success to Host.
@@ -873,7 +920,7 @@
         PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***\n"));)
 
         psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
 
         /**
         * Need to send Reassoc response with
@@ -888,7 +935,7 @@
         *   but we still have the link with the Older AP
         */
         psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
 
         /**
         * Need to send Reassoc response with
@@ -900,15 +947,12 @@
     }else {
         // Reassociation failure
         psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
         /**
          * Need to send Reassoc response with
          * Association failure to Host.
          */
-        limSendSmeJoinReassocRsp(
-                           pMac, eWNI_SME_REASSOC_RSP,
-                           pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
-                           psessionEntry->smeSessionId,psessionEntry->transactionId);
+        limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
     }
 } /*** end limProcessMlmReassocCnf() ***/
 
@@ -982,7 +1026,7 @@
     msgQ.type = eWNI_SME_REASSOC_IND;
     msgQ.bodyptr = pSirSmeReassocInd;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, 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
@@ -1046,7 +1090,7 @@
     msgQ.type = eWNI_SME_AUTH_IND;
     msgQ.bodyptr = pSirSmeAuthInd;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, 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
@@ -1095,7 +1139,6 @@
                                 pAssocInd->addIE.length);
 
     // Copy the new TITAN capabilities
-    pSirSmeAssocInd->titanHtCaps = pAssocInd->titanHtCaps;
     pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
     if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
     {
@@ -1195,7 +1238,7 @@
 #ifdef WLAN_SOFTAP_FEATURE
    pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
 #endif
-    MTRACE(macTraceMsgTx(pMac, 0, 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
@@ -1271,7 +1314,7 @@
         case eLIM_STA_ROLE:
         case eLIM_BT_AMP_STA_ROLE:
         psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
             break;
         default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
                 PELOG1(limLog(pMac, LOG1,
@@ -1357,7 +1400,7 @@
                 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
             else
                 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
             // Send Promiscuous mode response to host
             limSendSmePromiscuousModeRsp(pMac);
         }
@@ -1367,7 +1410,7 @@
                 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
             else
                 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
             limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
                                   resultCode,
                                   pMlmDisassocCnf->disassocTrigger,
@@ -1420,7 +1463,7 @@
         case eLIM_STA_ROLE:
         case eLIM_BT_AMP_STA_ROLE:
             psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
 
         default: // eLIM_AP_ROLE
             {
@@ -1516,7 +1559,7 @@
         }
         else
             psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
 
         if (pMac->lim.gLimRspReqd)
             pMac->lim.gLimRspReqd = false;
@@ -1606,7 +1649,7 @@
             if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
             {
                 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
-                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
 
 #if defined(ANI_AP_CLIENT_SDK)
                 // Whenever there is a disassoc notification, make sure the bssId is cleared so that
@@ -1669,13 +1712,13 @@
 limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
     // Prepare and send SME_SETCONTEXT_RSP message
-    tLimMlmSetKeysCnf  *pMlmSetKeysCnf;
+    tLimMlmSetKeysCnf   *pMlmSetKeysCnf;
     tpPESession        psessionEntry;
 
     if(pMsgBuf == NULL)
     {
-           PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
-           return;
+        PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+        return;
     }
     pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
     if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
@@ -1718,13 +1761,13 @@
 limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
     // Prepare and send SME_REMOVECONTEXT_RSP message
-    tLimMlmRemoveKeyCnf  *pMlmRemoveKeyCnf;
+    tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
     tpPESession          psessionEntry;
 
     if(pMsgBuf == NULL)
     {
-           PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
-           return;
+        PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+        return;
     }
     pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
     if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
@@ -1736,7 +1779,7 @@
         FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d\n"),
         pMlmRemoveKeyCnf->resultCode );
     limSendSmeRemoveKeyRsp(pMac,
-                            pMlmRemoveKeyCnf->peerMacAddr,
+                           pMlmRemoveKeyCnf->peerMacAddr,
                             (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
                             psessionEntry->smeSessionId,psessionEntry->transactionId);
 } /*** end limProcessMlmRemoveKeyCnf() ***/
@@ -1790,6 +1833,8 @@
             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);
+            palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
+            psessionEntry->pLimJoinReq = NULL;
             return;
         }
     }
@@ -1801,6 +1846,9 @@
     {
         if(NULL != psessionEntry)
         {
+           if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
+                psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+               PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState.\n"));)
             peDeleteSession(pMac,psessionEntry);
             psessionEntry = NULL;
         }
@@ -1810,6 +1858,68 @@
 } /*** end limHandleSmeJoinResult() ***/
 
 /**
+ * limHandleSmeReaasocResult()
+ *
+ *FUNCTION:
+ * This function is called to process reassoc failures
+ * upon receiving REASSOC_CNF with a failure code or
+ * MLM_REASSOC_CNF with a success code in case of STA role 
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param  pMac         Pointer to Global MAC structure
+ * @param  resultCode   Failure code to be sent
+ *
+ *
+ * @return None
+ */
+static void
+limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
+{
+    tpDphHashNode pStaDs = NULL;
+    tANI_U8         smesessionId;
+    tANI_U16        smetransactionId;
+
+    if(psessionEntry == NULL)
+    {
+        PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL \n"));)
+        return;
+    }
+    smesessionId = psessionEntry->smeSessionId;
+    smetransactionId = psessionEntry->transactionId;
+    /* When associations is failed , delete the session created  and pass NULL  to  limsendsmeJoinReassocRsp() */
+    if(resultCode != eSIR_SME_SUCCESS)
+    {
+          pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
+          if (pStaDs != NULL)
+          {
+            pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
+            pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
+            pStaDs->mlmStaContext.resultCode = resultCode;
+            pStaDs->mlmStaContext.protStatusCode = protStatusCode;
+            limCleanupRxPath(pMac, pStaDs, psessionEntry);
+            return;
+        }
+    }
+
+    //Delete teh session if REASSOC failure occurred.
+    if(resultCode != eSIR_SME_SUCCESS)
+    {
+        if(NULL != psessionEntry)
+        {
+            peDeleteSession(pMac,psessionEntry);
+            psessionEntry = NULL;
+        }
+    }
+    limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
+                                                smesessionId,  smetransactionId);
+} /*** end limHandleSmeReassocResult() ***/
+
+/**
   * limProcessMlmAddStaRsp()
  *
  *FUNCTION:
@@ -1833,13 +1943,6 @@
     //in the case of nested request the new request initiated from the response will take care of resetting
     //the deffered flag.
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
-#ifdef ANI_PRODUCT_TYPE_AP
-    if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
-    {
-        limProcessApMlmAddStaRsp(pMac, limMsgQ);
-        return;
-    }
-#endif
     if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
 #ifdef WLAN_SOFTAP_FEATURE
     || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
@@ -1890,7 +1993,7 @@
             FL( "Unable to get the DPH Hash Entry for AID - %d\n" ),
             DPH_STA_HASH_INDEX_PEER);
         psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
         /*
         * Storing the self StaIndex(Generated by HAL) in session context,
         * instead of storing it in DPH Hash entry for Self STA.
@@ -1900,7 +2003,7 @@
         psessionEntry->staId = pAddStaParams->staIdx;
         //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
         limReactivateHeartBeatTimer(pMac, psessionEntry);
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_KEEPALIVE_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
 
         //assign the sessionId to the timer Object
         pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
@@ -1943,13 +2046,6 @@
    //     return;
   //  }
   SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
- #ifdef ANI_PRODUCT_TYPE_AP
-    if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
-    {
-        limProcessApMlmDelBssRsp(pMac, limMsgQ);
-        return;
-    }
-#endif
 
     if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)  ||
          (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
@@ -2003,6 +2099,10 @@
     else
     {
         limLog( pMac, LOGP, FL( "DEL BSS failed!\n" ) );
+        if( NULL != pDelBssParams )
+        {
+            palFreeMemory( pMac->hHdd, (void *) pDelBssParams );
+    	}
         return;
     }
    end:
@@ -2028,58 +2128,6 @@
     return;
 }
 
-
-#ifdef ANI_PRODUCT_TYPE_AP
-void limProcessApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
-{
-    tSirResultCodes rc = eSIR_SME_SUCCESS;
-    tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
-    if (pDelBss == NULL)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!\n"));)
-        rc = eSIR_SME_REFUSED;
-        goto end;
-    }
-    if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pMac->lim.gLimMlmState)
-    {
-            limLog( pMac, LOGE,
-                        FL( "Received unexpected WDA_DEL_BSS_RSP in state %X\n" ), pMac->lim.gLimMlmState);
-            rc = eSIR_SME_REFUSED;
-           goto end;
-    }
-    if (pDelBss->status != eHAL_STATUS_SUCCESS)
-    {
-        limLog(pMac, LOGP, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
-               pDelBss->status, pDelBss->bssIdx);
-        rc = eSIR_SME_STOP_BSS_FAILURE;
-        goto end;
-    }
-    //Not used for station or softap.
-    rc = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE);
-    if( rc != eSIR_SUCCESS )
-        goto end;
-    /** Softmac may send all the buffered packets right after resuming the transmission hence
-     * to occupy the medium during non channel occupancy period. So resume the transmission after
-     * HAL gives back the response.
-     */
-    if (LIM_IS_RADAR_DETECTED(pMac))
-    {
-         limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
-         LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
-    }
-    dphHashTableClassInit(pMac);
-    limDeletePreAuthList(pMac);
-    //Is it ok to put LIM into IDLE state.
-    pMac->lim.gLimMlmState->limMlmState = eLIM_MLM_IDLE_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
-
-    end:
-    limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc);
-    if(pDelBss != NULL)
-        palFreeMemory( pMac->hHdd, (void *) pDelBss );
-}
-#endif
-/* This code is same as limProcessApMlmDelBssRsp used for BT-AMP  */
 void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
 {
     tSirResultCodes rc = eSIR_SME_SUCCESS;
@@ -2090,6 +2138,8 @@
     if(psessionEntry == NULL)
     {
         limLog(pMac, LOGE,FL("Session entry passed is NULL\n"));
+        if(pDelBss != NULL)
+            palFreeMemory( pMac->hHdd, (void *) pDelBss );
         return;
     }
 
@@ -2102,11 +2152,11 @@
     pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
     if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
     {
-        limLog(pMac, LOGE,
+            limLog( pMac, LOGE,
                FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
                psessionEntry->limMlmState);
-        rc = eSIR_SME_REFUSED;
-        goto end;
+            rc = eSIR_SME_REFUSED;
+           goto end;
     }
     if (pDelBss->status != eHAL_STATUS_SUCCESS)
     {
@@ -2126,11 +2176,13 @@
      * to occupy the medium during non channel occupancy period. So resume the transmission after
      * HAL gives back the response.
      */
+#if 0 //TODO: How to handle this per session
     if (LIM_IS_RADAR_DETECTED(pMac))
     {
          limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
          LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
     }
+#endif
     dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
     limDeletePreAuthList(pMac);
 #ifdef WLAN_SOFTAP_FEATURE
@@ -2158,16 +2210,11 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteStaParams->sessionId))==NULL)
     {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+        if(pDeleteStaParams != NULL)
+            palFreeMemory( pMac->hHdd, (void *) pDeleteStaParams );
         return;
     }
 
-#ifdef ANI_PRODUCT_TYPE_AP
-    if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
-    {
-        limProcessApMlmDelStaRsp(pMac, limMsgQ);
-        return;
-    }
-#endif
     if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
 #ifdef WLAN_SOFTAP_FEATURE
       || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
@@ -2182,89 +2229,6 @@
 #endif
 }
 
-#ifdef ANI_PRODUCT_TYPE_AP
-void limProcessApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
-{
-    tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
-    tpDphHashNode pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId);
-    tSirResultCodes statusCode = eSIR_SME_SUCCESS;
-    if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
-    {
-           limLog( pMac, LOGW,
-                      FL( "AP received the DEL_STA_RSP for assocID: %X.\n"), pDelStaParams->assocId);
-        if(pStaDs == NULL)
-        {
-             limLog( pMac, LOGE,
-                  FL( "DPH Entry for STA %X missing.\n"), pDelStaParams->assocId);
-             statusCode = eSIR_SME_REFUSED;
-             goto end;
-        }
-         if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
-            ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
-        {
-            limLog( pMac, LOGE,
-              FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d \n" ),
-               limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
-            statusCode = eSIR_SME_REFUSED;
-           goto end;
-        }
-
-        PELOG1(limLog( pMac, LOG1,
-            FL("Deleted STA AssocID %d staId %d MAC "),
-            pStaDs->assocId, pStaDs->staIndex);
-        limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
-       if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
-       {
-            if( 0 != limMsgQ->bodyptr )
-            {
-              palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
-            }
-            if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
-            {
-                PELOGE(limLog(pMac, LOGE,
-                       FL("could not Add STA with assocId=%d\n"),
-                       pStaDs->assocId);)
-              // delete the TS if it has already been added.
-               // send the response with error status.
-                if(pStaDs->qos.addtsPresent)
-                {
-                  tpLimTspecInfo pTspecInfo;
-                  if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
-                            &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
-                  {
-                    limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
-                                                            NULL, &pTspecInfo->idx);
-                  }
-                }
-                limRejectAssociation(pMac,
-                         pStaDs->staAddr,
-                         pStaDs->mlmStaContext.subType,
-                         true, pStaDs->mlmStaContext.authType,
-                         pStaDs->assocId, true,
-                         (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS);
-            }
-            return;
-        }
-   }
-    else
-    {
-        limLog( pMac, LOGW,
-             FL( "DEL STA failed!\n" ));
-        statusCode = eSIR_SME_REFUSED;
-    }
-    end:
-    if( 0 != limMsgQ->bodyptr )
-    {
-      palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
-    }
-    if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
-    {
-       limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
-    }
-      return;
-}
-#endif
-/* This is the copy of  limProcessApMlmDelStaRsp used for BT-AMP Support  */
 void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
 {
     tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
@@ -2403,95 +2367,6 @@
     return;
 }
 
-#ifdef ANI_PRODUCT_TYPE_AP
-void limProcessApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
-{
-    tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
-    tpDphHashNode pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId);
-    if(pStaDs == NULL)
-    {
-        //TODO: any response to be sent out here ?
-        limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"), pAddStaParams->assocId);
-        goto end;
-    }
-    //
-    // TODO & FIXME_GEN4
-    // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
-    //
-    //TODO: any check for pMac->lim.gLimMlmState ?
-    if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
-    {
-        //TODO: any response to be sent out here ?
-        limLog( pMac, LOGE,
-                FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ),
-                pStaDs->mlmStaContext.mlmState);
-        goto end;
-    }
-    if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d\n"),pAddStaParams->status);)
-        limRejectAssociation(pMac, pStaDs->staAddr,
-                 pStaDs->mlmStaContext.subType,
-                 true, pStaDs->mlmStaContext.authType,
-                 pStaDs->assocId, true,
-                 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS);
-        goto end;
-    }
-    pStaDs->bssId = pAddStaParams->bssIdx;
-    pStaDs->staIndex = pAddStaParams->staIdx;
-    pStaDs->ucUcastSig    = pAddStaParams->ucUcastSig;
-    pStaDs->ucBcastSig    = pAddStaParams->ucBcastSig;
-    if(pStaDs->qos.addtsPresent)
-    {
-        //need to send halMsg_AddTs to HAL.
-        tpLimTspecInfo pTspecInfo;
-        if(eSIR_SUCCESS ==
-           limTspecFindByAssocId(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec,
-                                 &pMac->lim.tspecInfo[0], &pTspecInfo))
-        {
-            if(eSIR_SUCCESS != limSendHalMsgAddTs(pMac, pStaDs->staIndex, pTspecInfo->idx, pStaDs->qos.addts.tspec))
-            {
-                // delete the TS that has already been added.
-                // send the response with error status.
-                limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo, NULL, &pTspecInfo->idx);
-                PELOGE(limLog(pMac, LOGE,
-                 FL("limSendHalMsgAddTs failed for STA with assocId=%d\n"),
-                 pStaDs->assocId);)
-                limRejectAssociation(pMac,
-                   pStaDs->staAddr, pStaDs->mlmStaContext.subType,
-                   true, pStaDs->mlmStaContext.authType,
-                   pStaDs->assocId, false,
-                   (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS);
-                if( 0 != limMsgQ->bodyptr )
-                {
-                    palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
-                }
-                limDelSta(pMac, pStaDs, true,psessionEntry);
-                return;
-            }
-        }
-    }
-    //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
-    pStaDs->valid = 1;
-    pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
-    PELOG1(limLog( pMac, LOG1,
-            FL("STA AssocID %d staId %d MAC "),
-            pStaDs->assocId,
-            pStaDs->staIndex);
-    limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
-    // Send Re/Association Response with
-    // status code to requesting STA.
-    limSendAssocRspMgmtFrame(pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
-                             pStaDs->mlmStaContext.subType, pStaDs,psessionEntry);
-end:
-    if( 0 != limMsgQ->bodyptr )
-    {
-        palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
-    }
-    return;
-}
-#endif
-/* This is the copy of  limProcessApMlmAddStaRsp function .... used for BT-AMP AP Support */
 void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
 {
     tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
@@ -2602,6 +2477,8 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
+        if( NULL != pAddBssParams )
+            palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
         return;
     }
     /* Update PE session Id*/
@@ -2614,7 +2491,7 @@
             goto end;
         // Set MLME state
         psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId,  psessionEntry->limMlmState));
         if( eSIR_IBSS_MODE == pAddBssParams->bssType )
         {
             /** IBSS is 'active' when we receive
@@ -2625,7 +2502,7 @@
             psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
             limResetHBPktCount( psessionEntry );
             limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
-            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
             if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
                 limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
         }
@@ -2717,7 +2594,7 @@
             goto end;
         // Set MLME state
         psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
         /** IBSS is 'active' when we receive
          * Beacon frames from other STAs that are part of same IBSS.
          * Mark internal state as inactive until then.
@@ -2726,7 +2603,7 @@
         limResetHBPktCount( psessionEntry );
         /* Timer related functions are not modified for BT-AMP : To be Done */
         limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
         if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
             limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
         psessionEntry->bssIdx     = (tANI_U8) pAddBssParams->bssIdx;
@@ -2844,14 +2721,14 @@
             // SUNIT_FIX_ME:  Set BOTH? Assume not. Please verify here and below.
             //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
             psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_JOINED_STATE));
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
             pMlmAuthReq->sessionId = psessionEntry->peSessionId;
             psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
             psessionEntry->limSmeState     = eLIM_SME_WT_AUTH_STATE;
             // remember staId in case of assoc timeout/failure handling
             psessionEntry->staId = pAddBssParams->staContext.staIdx;
 
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
             limPostMlmMessage(pMac,
                               LIM_MLM_AUTH_REQ,
                               (tANI_U32 *) pMlmAuthReq);
@@ -2861,7 +2738,7 @@
 joinFailure:
     {
         psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
 
         /// Send Join response to Host
         limHandleSmeJoinResult(pMac,  eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
@@ -2917,7 +2794,7 @@
     // start reassoc timer.
     pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
     /// Start reassociation failure timer
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_REASSOC_FAIL_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
     if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
                                                != TX_SUCCESS)
     {
@@ -2993,18 +2870,22 @@
     pAddStaParams->updateSta = FALSE;
 
     pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
+#ifdef WLAN_FEATURE_11AC
+    limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
+#else
     limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
+#endif
 
-    if( psessionEntry->htCapabality)
+    if( psessionEntry->htCapability)
     {
-        pAddStaParams->htCapable = psessionEntry->htCapabality;
+        pAddStaParams->htCapable = psessionEntry->htCapability;
 #ifdef DISABLE_GF_FOR_INTEROP
         /*
          * To resolve the interop problem with Broadcom AP,
          * where TQ STA could not pass traffic with GF enabled,
          * TQ STA will do Greenfield only with TQ AP, for
          * everybody else it will be turned off.
-        */
+         */
         if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
         {
             limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
@@ -3142,7 +3023,7 @@
 
          // Set MLME state
         psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
         psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session  started for self or for  peer oct6th
         // Now, send WDA_ADD_STA_REQ
         limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful\n" ));
@@ -3254,6 +3135,8 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
     {
         limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" ));
+            if( NULL != pAddBssParams )
+                palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
         return;
     }
     /* update PE session Id*/
@@ -3324,14 +3207,14 @@
  */
 void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
 {
-    tANI_U8 respReqd = 1;
+    tANI_U8           respReqd = 1;
     tLimMlmSetKeysCnf mlmSetKeysCnf;
     tANI_U8  sessionId = 0;
     tpPESession  psessionEntry;
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
     palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
    //BTAMP
-    if(NULL == limMsgQ->bodyptr)
+    if( NULL == limMsgQ->bodyptr )
     {
         PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
         return;
@@ -3340,12 +3223,13 @@
     if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
+        palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
         return;
     }
     if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
     {
         // Mesg received from HAL in Invalid state!
-        limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, pMac->lim.gLimMlmState );
+        limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState );
         // There's not much that MLME can do at this stage...
         respReqd = 0;
     }
@@ -3354,9 +3238,8 @@
 
     palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
     // Restore MLME state
-    //pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
     psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
     if( respReqd )
     {
         tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
@@ -3365,27 +3248,27 @@
         {
             palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
 #ifdef ANI_PRODUCT_TYPE_AP
-      mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
+            mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
 #endif
             // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
-            palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
+            palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
             pMac->lim.gpLimMlmSetKeysReq = NULL;
         }
         mlmSetKeysCnf.sessionId = sessionId;
-        limPostSmeMessage( pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf );
+        limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
     }
 }
 void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
 {
     tANI_U8 respReqd = 1;
     tLimMlmSetKeysCnf mlmSetKeysCnf;
-    tANI_U16 resultCode;
-    tANI_U8  sessionId =0;
+    tANI_U16          resultCode;
+    tANI_U8           sessionId = 0;
     tpPESession  psessionEntry;
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
     palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
    //BTAMP
-    if(NULL == limMsgQ->bodyptr)
+    if( NULL == limMsgQ->bodyptr )
     {
         PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null\n"));)
         return;
@@ -3394,6 +3277,7 @@
     if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
+        palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
         return;
     }
     if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
@@ -3401,10 +3285,10 @@
     else
         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!
-  //
+    //
+    // 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 )
   //{
@@ -3413,7 +3297,7 @@
         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 %X\n" ), limMsgQ->type, pMac->lim.gLimMlmState );
+        limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState );
         // There's not much that MLME can do at this stage...
         respReqd = 0;
     }
@@ -3422,10 +3306,9 @@
 
     palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
     // Restore MLME state
-    //pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
     psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
     if( respReqd )
     {
         tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
@@ -3436,13 +3319,13 @@
         {
             palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
 #ifdef ANI_PRODUCT_TYPE_AP
-      mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
+            mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
 #endif
             // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
-            palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
+            palFreeMemory(pMac->hHdd, (tANI_U8 *) 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);
     }
 }
 /**
@@ -3463,54 +3346,77 @@
  */
 void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
 {
-tLimMlmRemoveKeyCnf mlmRemoveCnf;
-tANI_U16 resultCode;
-tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
-  SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
-  palZeroMemory( pMac->hHdd,
-      (void *) &mlmRemoveCnf,
-      sizeof( tLimMlmRemoveKeyCnf ));
-  // Validate MLME state
-    if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != pMac->lim.gLimMlmState &&
-        eLIM_MLM_WT_REMOVE_STA_KEY_STATE != pMac->lim.gLimMlmState )
+    tANI_U8 respReqd = 1;
+    tLimMlmRemoveKeyCnf mlmRemoveCnf;
+    tANI_U16             resultCode;
+    tANI_U8              sessionId = 0;
+    tpPESession  psessionEntry;
+    SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+    palZeroMemory( pMac->hHdd, (void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ));
+
+    if( NULL == limMsgQ->bodyptr )
     {
-      // Mesg received from HAL in Invalid state!
-      limLog( pMac, LOGW,
-          FL( "Received unexpected [Mesg Id - %d] in state %X\n" ),
-          limMsgQ->type,
-          pMac->lim.gLimMlmState );
-          return; //ignore the response.
+        PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
+        return;
     }
 
-  if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == pMac->lim.gLimMlmState )
-    resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
-  else
-    resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
-  //
-  // TODO & FIXME_GEN4
-  // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
-  //
+    if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
+        sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
+    else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
+        sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
 
-  if( 0 != limMsgQ->bodyptr )
-    palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
-  // Restore MLME state
-  pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
-  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
-    // Prepare and Send LIM_MLM_REMOVEKEY_CNF
-    if( NULL != lpLimMlmRemoveKeyReq )
+    if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
     {
-      palCopyMemory( pMac->hHdd,
-          (tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
-          (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
-          sizeof( tSirMacAddr ));
-      mlmRemoveCnf.resultCode = resultCode;
-      // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
-      palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq);
-      pMac->lim.gpLimMlmRemoveKeyReq = NULL;
-     }
-     limPostSmeMessage( pMac,
-        LIM_MLM_REMOVEKEY_CNF,
-        (tANI_U32 *) &mlmRemoveCnf );
+        PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
+        return;
+    }
+
+    if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
+      resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
+    else
+      resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
+
+    // Validate MLME state
+    if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
+        eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
+    {
+        // Mesg received from HAL in Invalid state!
+        limLog(pMac, LOGW,
+            FL("Received unexpected [Mesg Id - %d] in state %X\n"),
+          limMsgQ->type,
+          psessionEntry->limMlmState );
+          respReqd = 0;
+    }
+    else
+        mlmRemoveCnf.resultCode = resultCode;
+
+    //
+    // TODO & FIXME_GEN4
+    // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
+    //
+
+    palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
+
+    // Restore MLME state
+    psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+
+    if( respReqd )
+    {
+        tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
+        mlmRemoveCnf.sessionId = sessionId;
+
+    // Prepare and Send LIM_MLM_REMOVEKEY_CNF
+        if( NULL != lpLimMlmRemoveKeyReq )
+    {
+            palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmRemoveCnf.peerMacAddr, (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
+                      sizeof( tSirMacAddr ));
+        // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
+        palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq);
+        pMac->lim.gpLimMlmRemoveKeyReq = NULL;
+    }
+        limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
+    }
 }
 
 #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
@@ -3741,7 +3647,7 @@
         goto end;
     }
     /// Start reassociation failure timer
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_REASSOC_FAIL_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
     if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
                                                != TX_SUCCESS)
     {
@@ -3814,17 +3720,7 @@
         goto error;
     }
 
-    // Activate Join failure timer
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_JOIN_FAIL_TIMER));
-    if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
-    {
-        limLog(pMac, LOGP, FL("could not activate Join failure timer\n"));
-        psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-         MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
-        //memory is freed up below.
-        psessionEntry->pLimMlmJoinReq = NULL;
-        goto error;
-    }
+   
     /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified   */
     if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
     {
@@ -3867,6 +3763,19 @@
            psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
            psessionEntry->selfMacAddr, psessionEntry->dot11mode,
            psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
+
+    // Sending mgmt frame is a blocking call activate Join failure timer now
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
+    if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("could not activate Join failure timer\n"));
+        psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
+         MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
+        //memory is freed up below.
+        psessionEntry->pLimMlmJoinReq = NULL;
+        goto error;
+    }
+
     return;
 error:  
     if(NULL != psessionEntry)
@@ -4075,7 +3984,29 @@
             }
             else
             {
-               pMac->lim.gLimCurrentScanChannelId++;
+               //Skip Dfs Channel in case of P2P Search
+               //If skipDfsChnlInP2pSearch is set in ini
+               if( ( pMac->lim.gpLimMlmScanReq != NULL ) &&
+                   pMac->lim.gpLimMlmScanReq->p2pSearch &&
+                   pMac->lim.gpLimMlmScanReq->skipDfsChnlInP2pSearch )
+               {
+                  int flag = 0;
+                  while(!flag)
+                  {
+                     pMac->lim.gLimCurrentScanChannelId++;
+                     if( (pMac->lim.gLimCurrentScanChannelId >
+                   (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))||
+                        (limActiveScanAllowed(pMac, limGetCurrentScanChannel(pMac))))
+                     {
+                       flag=1; //Bail out from here
+                     }
+                  }
+               }
+               else
+               {
+                  pMac->lim.gLimCurrentScanChannelId++;
+               }
+
                limContinueChannelScan(pMac);
             }
             break;
@@ -4113,10 +4044,69 @@
     }
     return;
 }
+/**
+ *  limStopTxAndSwitch()
+ *
+ *FUNCTION:
+ * Start channel switch on all sessions that is in channel switch state.
+ *
+ * @param pMac                   - pointer to global adapter context
+ *
+ * @return None
+ *
+ */
+static void
+limStopTxAndSwitch (tpAniSirGlobal pMac)
+{
+    tANI_U8 i;
+
+    for(i =0; i < pMac->lim.maxBssId; i++)
+    {
+        if(pMac->lim.gpSession[i].valid && 
+            pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+        {
+            limStopTxAndSwitchChannel(pMac, i);
+        }
+    }
+    return; 
+}
+/**
+ * limStartQuietOnSession()
+ *
+ *FUNCTION:
+ * This function is called to start quiet timer after finish scan if there is  
+ *      qeuieting on any session.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param  pMac    - Pointer to Global MAC structure
+ *
+ * @return None
+ */
+static void
+limStartQuietOnSession (tpAniSirGlobal pMac)
+{
+    tANI_U8 i;
+
+    for(i =0; i < pMac->lim.maxBssId; i++)
+    {
+        if(pMac->lim.gpSession[i].valid && 
+            pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
+        {
+            limStartQuietTimer(pMac, i);
+        }
+    }
+    return;
+}
 void limProcessFinishScanRsp(tpAniSirGlobal pMac,  void *body)
 {
     tpFinishScanParams      pFinishScanParam;
-    tANI_U8                 dummySessionId = 0;
     eHalStatus              status;
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
     pFinishScanParam = (tpFinishScanParams) body;
@@ -4127,21 +4117,21 @@
         case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
             pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
             limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
-            if (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+            if (limIsChanSwitchRunning(pMac))
             {
                 /** Right time to stop tx and start the timer for channel switch */
                 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
                  * be any associated session id
                 */
-                limStopTxAndSwitchChannel(pMac, dummySessionId);
+                limStopTxAndSwitch(pMac);
             }
-            else if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
+            else if (limIsQuietBegin(pMac))
             {
                 /** Start the quieting */
                 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
                  * be any associated session id
                 */
-                limStartQuietTimer(pMac, dummySessionId);
+                limStartQuietOnSession(pMac);
             }
 #ifdef ANI_PRODUCT_TYPE_AP
             /* For handling the measurement request from WSM as scan request in LIM*/
@@ -4283,6 +4273,7 @@
   if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
   {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
+        palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
         return;
   }
   // First, extract the DPH entry
@@ -4301,7 +4292,7 @@
     PELOGE(limLog( pMac, LOGE,
         FL( "Received unexpected ADDBA CNF when STA BA state is %d\n" ),
         curBaState );)
-    palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
+      palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
     return;
   }
   // Restore STA BA state
@@ -4380,6 +4371,7 @@
     if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
    {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+        palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
         return;
    }
     // First, extract the DPH entry
@@ -4388,6 +4380,7 @@
     {
         limLog( pMac, LOGE,
             FL( "STA context not found - ignoring DELBA CNF from HAL\n" ));
+        palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
         return;
     }
     if(NULL == pMlmDelBACnf)
@@ -4403,6 +4396,7 @@
         limLog( pMac, LOGE,
         FL( "Received unexpected DELBA CNF when STA BA state is %d\n" ),
         curBaState );
+        palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
         return;
     }
     // Restore STA BA state
@@ -4437,6 +4431,7 @@
     if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
+        palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
         return;
     }
     // First, extract the DPH entry
@@ -4595,7 +4590,7 @@
     /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
     /** Set the MlmState to IDLE*/
     psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
    /* Update PE session Id*/
     mlmReassocCnf.sessionId = psessionEntry->peSessionId;
     switch (psessionEntry->limMlmState) {
@@ -4676,13 +4671,13 @@
             mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
             /** Set the SME State back to WT_Reassoc State*/
             psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
             limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
             if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
                 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
             {
                psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-               MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+               MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
             }
             limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
         }
@@ -4694,7 +4689,7 @@
             mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
             goto Error;
     }
-return;
+    return;
 Error:
     limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
 }
@@ -4773,7 +4768,8 @@
     tLimMlmReassocCnf           mlmReassocCnf;
     /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
     /** Set the MlmState to IDLE*/
-    pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
+    psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
     switch (psessionEntry->limSmeState) {
 #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
         case eLIM_SME_WT_REASSOC_STATE : {
diff --git a/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c b/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
index ecb7719..48f839c 100644
--- a/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
+++ b/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
@@ -549,7 +549,7 @@
                         pSirSmeProbeReq->sessionId = psessionEntry->smeSessionId;
                         palCopyMemory( pMac->hHdd, pSirSmeProbeReq->peerMacAddr, pHdr->sa, sizeof(tSirMacAddr));
                         pSirSmeProbeReq->devicePasswdId = probeReq.probeReqWscIeInfo.DevicePasswordID.id;
-                        MTRACE(macTraceMsgTx(pMac, 0, 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 "));)
                         }
@@ -731,7 +731,8 @@
     //send the probe req to SME.
     limSendSmeMgmtFrameInd( pMac, pHdr->fc.subType,
                (tANI_U8*)pHdr, (frameLen + sizeof(tSirMacMgmtHdr)), 
-               psessionEntry->smeSessionId, WDA_GET_RX_CH(pBd) );
+               psessionEntry->smeSessionId, WDA_GET_RX_CH(pBd),
+               psessionEntry);
 #ifdef WLAN_FEATURE_P2P_INTERNAL
     limSendP2PProbeResponse(pMac, pBd, psessionEntry);
 #endif
@@ -863,7 +864,7 @@
     palCopyMemory( pMac->hHdd, pSirSmeProbeReqInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
     palCopyMemory( pMac->hHdd, pSirSmeProbeReqInd->WPSPBCProbeReq.peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
 
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
     pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIELen = (tANI_U16)ProbeReqIELen;
     palCopyMemory( pMac->hHdd, pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIE, pProbeReqIE, ProbeReqIELen);
     
diff --git a/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c b/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
index 6df50de..3d63939 100644
--- a/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
+++ b/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
@@ -237,8 +237,8 @@
                 {
                     limUpdateQuietIEFromBeacon(pMac, &(probeRsp.quietIE), psessionEntry);
                 }
-                else if ((pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
-                     (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
+                else if ((psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
+                     (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
                 {
                     PELOG1(limLog(pMac, LOG1, FL("Received a probe rsp without Quiet IE\n"));)
                     limCancelDot11hQuiet(pMac, psessionEntry);
@@ -249,7 +249,7 @@
                 {
                     limUpdateChannelSwitch(pMac, &probeRsp, psessionEntry);
                 }
-                else if (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+                else if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
                 {
                     limCancelDot11hChannelSwitch(pMac, psessionEntry);
                 }
diff --git a/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c b/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
index 9f1a1bf..9c8fd60 100644
--- a/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
@@ -124,7 +124,7 @@
     if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
     {
         limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
-     MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
+     MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
         if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
             limLog(pMac, LOGP, FL("could not activate background scan timer\n"));
         pMac->lim.gLimBackgroundScanStarted   = true;
@@ -316,7 +316,9 @@
 {
     /** fRadarDetCurOperChan will be set only if we detect radar in current
      * operating channel and System Role == AP ROLE */
-    if (LIM_IS_RADAR_DETECTED(pMac))
+    //TODO: Need to take care radar detection.
+    //if (LIM_IS_RADAR_DETECTED(pMac))
+    if( 0 )
     {
         if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
         {
@@ -365,7 +367,7 @@
     {
         pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
         
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
         
         /// By default do not return after first scan match
         pMac->lim.gLimReturnAfterFirstMatch = 0;
@@ -433,7 +435,7 @@
     }
 #endif
     PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL\n"));)
-    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
 
     if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
     {
@@ -443,7 +445,62 @@
     return eANI_BOOLEAN_FALSE;
 }
 
+#ifdef WLAN_FEATURE_11AC
 
+tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
+{
+    if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
+    {
+        switch(secondaryChanOffset)
+        {
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
+                return primarychanNum;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
+               return primarychanNum + 2;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
+               return primarychanNum - 2;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
+               return primarychanNum + 6;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
+               return primarychanNum + 2;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
+               return primarychanNum - 2;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
+               return primarychanNum - 6;
+            default :
+               return eSIR_CFG_INVALID_ID;
+        }
+    }
+    else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
+    {
+        switch(secondaryChanOffset)
+        {
+            case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
+                return primarychanNum + 2;
+            case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
+                return primarychanNum - 2;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
+                return primarychanNum;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
+               return primarychanNum + 2;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
+               return primarychanNum - 2;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
+               return primarychanNum + 2;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
+               return primarychanNum - 2;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
+               return primarychanNum + 2;
+            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
+               return primarychanNum - 2;
+            default :
+               return eSIR_CFG_INVALID_ID;
+        }
+    }
+    return primarychanNum;
+}
+
+#endif
 /**
  * __limHandleSmeStartBssRequest()
  *
@@ -473,7 +530,6 @@
     tpSirSmeStartBssReq     pSmeStartBssReq;                //Local variable for Start BSS Req.. Added For BT-AMP Support 
     tSirResultCodes         retCode = eSIR_SME_SUCCESS;
     tANI_U32                autoGenBssId = FALSE;           //Flag Used in case of IBSS to Auto generate BSSID.
-    tSirMacHTChannelWidth   txWidthSet;
     tANI_U8                 sessionId;
     tpPESession             psessionEntry = NULL;
     tANI_U8                 smesessionId;
@@ -581,8 +637,12 @@
         /* Store the dot 11 mode in to the session Table*/
 
         psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
-        psessionEntry->htCapabality = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
-
+        psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
+#ifdef WLAN_FEATURE_11AC
+        psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
+        VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_FATAL,
+            FL("*****psessionEntry->vhtCapability = %d\n"),psessionEntry->vhtCapability);
+#endif
         palCopyMemory(pMac->hHdd, (void*)&psessionEntry->rateSet,
             (void*)&pSmeStartBssReq->operationalRateSet,
             sizeof(tSirMacRateSet));
@@ -667,41 +727,73 @@
         if (pSmeStartBssReq->channelId)
         {
             channelNumber = pSmeStartBssReq->channelId;
-            /*Update cbMode received from sme with LIM's updated cbMode*/
-            pSmeStartBssReq->cbMode = (tAniCBSecondaryMode)pMac->lim.gCbMode;
+            psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
+            psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
+            psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
+            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+                      FL("cbMode %u"), pSmeStartBssReq->cbMode);
+#ifdef WLAN_FEATURE_11AC
+            if(psessionEntry->vhtCapability)
+            {
+                tANI_U32 centerChan;
+                tANI_U32 chanWidth;
 
-            setupCBState( pMac, pSmeStartBssReq->cbMode );
-            pMac->lim.gHTSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
-#ifdef WLAN_SOFTAP_FEATURE
-            txWidthSet = (tSirMacHTChannelWidth)limGetHTCapability(pMac, eHT_RECOMMENDED_TX_WIDTH_SET, psessionEntry);
-#else
-            txWidthSet = (tSirMacHTChannelWidth)limGetHTCapability(pMac, eHT_RECOMMENDED_TX_WIDTH_SET);
-#endif
-
-            /*
-                * If there is a mismatch in secondaryChannelOffset being passed in the START_BSS request and
-                * ChannelBonding CFG, then MAC will override the 'ChannelBonding' CFG with what is being passed
-                * in StartBss Request.
-                * HAL RA and PHY will go out of sync, if both these values are not consistent and will result in TXP Errors
-                * when HAL RA tries to use 40Mhz rates when CB is turned off in PHY.
-                */
-            if(((pMac->lim.gHTSecondaryChannelOffset == eHT_SECONDARY_CHANNEL_OFFSET_NONE) &&
-                    (txWidthSet == eHT_CHANNEL_WIDTH_40MHZ)) ||
-                    ((pMac->lim.gHTSecondaryChannelOffset != eHT_SECONDARY_CHANNEL_OFFSET_NONE) &&
-                    (txWidthSet == eHT_CHANNEL_WIDTH_20MHZ)))
+                if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
+                          &chanWidth) != eSIR_SUCCESS)
                 {
-                   PELOGW(limLog(pMac, LOGW, FL("secondaryChannelOffset and txWidthSet don't match, resetting txWidthSet CFG\n"));)
-                    txWidthSet = (txWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ;
-                    if (cfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, txWidthSet)
-                                        != eSIR_SUCCESS)
+                    limLog(pMac, LOGP,
+                      FL("Unable to retrieve Channel Width from CFG\n"));
+                }
+
+                if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ || chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
+                {
+                    if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
+                                                                     != eSIR_SUCCESS)
                     {
                         limLog(pMac, LOGP, FL("could not set  WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
                         retCode = eSIR_LOGP_EXCEPTION;
-                        goto free;
+                         goto free;
                     }
                 }
-        }
+                if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
+                {
+                    if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
+                                                                     != eSIR_SUCCESS)
+                    {
+                        limLog(pMac, LOGP, FL("could not set  WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
+                        retCode = eSIR_LOGP_EXCEPTION;
+                         goto free;
+                    }
 
+                    centerChan = limGetCenterChannel(pMac,channelNumber,pSmeStartBssReq->cbMode,WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
+                    if(centerChan != eSIR_CFG_INVALID_ID)
+                    {
+                        limLog(pMac, LOGW, FL("***Center Channel for 80MHZ channel width = %ld\n"),centerChan);
+                        if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1, centerChan)
+                                                                     != eSIR_SUCCESS)
+                        {
+                            limLog(pMac, LOGP, FL("could not set  WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
+                            retCode = eSIR_LOGP_EXCEPTION;
+                            goto free;
+                        }
+                    }
+                }
+
+                /* All the translation is done by now for gVhtChannelWidth from .ini file to 
+                 * the actual values as defined in spec. So, grabing the spec value which is 
+                 * updated in .dat file by the above logic */
+                if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
+                                   &chanWidth) != eSIR_SUCCESS)
+                {
+                    limLog(pMac, LOGP,
+                      FL("Unable to retrieve Channel Width from CFG\n"));
+                }
+
+                psessionEntry->vhtTxChannelWidthSet = chanWidth;
+            }
+            psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
+#endif
+        }
         else
         {
             PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ\n"));)
@@ -719,18 +811,10 @@
 
 #ifdef FIXME_GEN6   //following code may not be required. limInitMlm is now being invoked during peStart
         /// Initialize MLM state machine
-#ifdef ANI_PRODUCT_TYPE_AP
-            /* The Role is not set yet. Currently assuming the AddBss in Linux will be called by AP only.
-             * This should be handled when IBSS functionality is implemented in the Linux
-             * TODO */
-            pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
-#else
         limInitMlm(pMac);
 #endif
-#endif
 
-        psessionEntry->htCapabality = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
+        psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
 
 #ifdef WLAN_SOFTAP_FEATURE
             /* keep the RSN/WPA IE information in PE Session Entry
@@ -860,16 +944,13 @@
                       
         // Now populate the 11n related parameters
         pMlmStartReq->nwType    = psessionEntry->nwType;
-        pMlmStartReq->htCapable = psessionEntry->htCapabality;
+        pMlmStartReq->htCapable = psessionEntry->htCapability;
         //
         // FIXME_GEN4 - Determine the appropriate defaults...
         //
         pMlmStartReq->htOperMode        = pMac->lim.gHTOperMode;
         pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
-        pMlmStartReq->txChannelWidthSet = pMac->lim.gHTRecommendedTxWidthSet;
-
-        //Update the global LIM parameter, which is used to populate HT Info IEs in beacons/probe responses.
-        pMac->lim.gHTSecondaryChannelOffset = limGetHTCBState(pMlmStartReq->cbMode);
+        pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
 
         /* sep26 review */
         psessionEntry->limRFBand = limGetRFBand(channelNumber);
@@ -890,18 +971,9 @@
                 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED \n"));
         }
 
-#ifdef ANI_PRODUCT_TYPE_AP
-        PELOGE(limLog(pMac, LOGE, FL("Dot 11h is %s\n"), pMac->lim.gLim11hEnable?"Enabled":"Disabled");)
-        if (pMac->lim.gLim11hEnable)
-        { 
-           PELOG2(limLog(pMac, LOG2, FL("Cb state = %d, SecChanOffset = %d\n"),
-                   pMac->lim.gCbState, pMac->lim.gHTSecondaryChannelOffset);)
-            limRadarInit(pMac);
-        }
-#endif
         psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
         psessionEntry ->limSmeState     =  eLIM_SME_WT_START_BSS_STATE;
-     MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
 
         limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
         return;
@@ -1092,7 +1164,7 @@
          pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
         
         pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
 
         if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
         {
@@ -1214,6 +1286,7 @@
         pMlmScanReq->dot11mode = pScanReq->dot11mode;
 #ifdef WLAN_FEATURE_P2P
         pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
+        pMlmScanReq->skipDfsChnlInP2pSearch = pScanReq->skipDfsChnlInP2pSearch;
 #endif
 
         //Store the smeSessionID and transaction ID for later use.
@@ -1265,7 +1338,36 @@
 
 } /*** end __limProcessSmeScanReq() ***/
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
 
+static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+    tpSirOemDataReq    pOemDataReq;
+    tLimMlmOemDataReq* pMlmOemDataReq;
+
+    pOemDataReq = (tpSirOemDataReq) pMsgBuf; 
+
+    //post the lim mlm message now
+    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)&pMlmOemDataReq, (sizeof(tLimMlmOemDataReq))))
+    {
+        limLog(pMac, LOGP, FL("palAllocateMemory failed for mlmOemDataReq\n"));
+        return;
+    }
+
+    //Initialize this buffer
+    palZeroMemory(pMac->hHdd, pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)));
+
+    palCopyMemory(pMac->hHdd, pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr, sizeof(tSirMacAddr)); 
+    palCopyMemory(pMac->hHdd, pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE);
+
+    //Issue LIM_MLM_OEM_DATA_REQ to MLM
+    limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
+
+    return;
+
+} /*** end __limProcessSmeOemDataReq() ***/
+
+#endif //FEATURE_OEM_DATA_SUPPORT
 
 
 /**
@@ -1285,7 +1387,6 @@
  * @param  *pMsgBuf  A pointer to the SME message buffer
  * @return None
  */
-
 static void
 __limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
@@ -1338,9 +1439,6 @@
         }
         (void) palZeroMemory(pMac->hHdd, (void *) pSmeJoinReq, nSize);
  
-#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
-        handleHTCapabilityandHTInfo(pMac);
-#endif
         if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
                 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
         {
@@ -1400,7 +1498,8 @@
                 goto end;
             }
         }   
-        
+        handleHTCapabilityandHTInfo(pMac, psessionEntry);
+
         /* Store Session related parameters */
         /* Store PE session Id in session Table */
         psessionEntry->peSessionId = sessionId;
@@ -1428,18 +1527,25 @@
 
         psessionEntry->dot11mode  = pSmeJoinReq->dot11mode;
         psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
+#ifdef WLAN_FEATURE_11AC
+        psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL,
+            "***__limProcessSmeJoinReq: vhtCapability=%d****\n",psessionEntry->vhtCapability);
+#endif
 
         /*Phy mode*/
         psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
 
         /* 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
+        psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
+        psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
 
         /*Store Persona */
         psessionEntry->pePersona = pSmeJoinReq->staPersona;
         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
-                  FL("PE PERSONA=%d"), psessionEntry->pePersona);
+                  FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona, pSmeJoinReq->cbMode);
         
         /* Copy the SSID from smejoinreq to session entry  */  
         psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
@@ -1553,10 +1659,6 @@
 
         pMac->lim.gLimCurrentBssCaps =
             pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].capabilityInfo;
-
-        pMac->lim.gLimCurrentTitanHtCaps =
-             pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].titanHtCaps;
-
         palCopyMemory( pMac->hHdd,
          (tANI_U8 *) &pMac->lim.gLimCurrentSSID,
          (tANI_U8 *) &pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].ssId,
@@ -1569,30 +1671,19 @@
            (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
            psessionEntry->pLimJoinReq->bssDescription.length + 2);
 
-#if 0
-
-        pMac->lim.gLimCurrentChannelId =
-           psessionEntry->pLimJoinReq->bssDescription.channelId;
-#endif //oct 9th review remove globals
-
-        
         psessionEntry->limCurrentBssCaps =
-               psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
-        
+           psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
 
-        psessionEntry->limCurrentTitanHtCaps=
-                psessionEntry->pLimJoinReq->bssDescription.titanHtCaps;
-
-            regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel ); 
-            localPowerConstraint = regMax;
-            limExtractApCapability( pMac,
-               (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
-               limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
-               &psessionEntry->limCurrentBssQosCaps,
-               &psessionEntry->limCurrentBssPropCap,
-               &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH  make gLimCurrentBssUapsd this session specific
-               , &localPowerConstraint
-               ); 
+        regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel ); 
+        localPowerConstraint = regMax;
+        limExtractApCapability( pMac,
+           (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
+           limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
+           &psessionEntry->limCurrentBssQosCaps,
+           &psessionEntry->limCurrentBssPropCap,
+           &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH  make gLimCurrentBssUapsd this session specific
+           , &localPowerConstraint
+           ); 
 #ifdef FEATURE_WLAN_CCX
             psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
 #else
@@ -1628,9 +1719,9 @@
         //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
         pMac->lim.gLimIbssCoalescingHappened = false;
 
-        psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
-        psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+            psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
+            psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
 
         PELOG1(limLog(pMac, LOG1, FL("SME JoinReq: SSID %d.%c%c%c%c%c%c\n"),
                psessionEntry->ssId.length,
@@ -1711,152 +1802,6 @@
 }
 #endif
 
-
-#if 0
-/**
- * __limProcessSmeAuthReq()
- *
- *FUNCTION:
- * This function is called to process SME_AUTH_REQ message
- * from HDD or upper layer application.
- *
- *LOGIC:
- *
- *ASSUMPTIONS:
- *
- *NOTE:
- *
- * @param  pMac      Pointer to Global MAC structure
- * @param  *pMsgBuf  A pointer to the SME message buffer
- * @return None
- */
-
-static void
-__limProcessSmeAuthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
-{
-
-    tAniAuthType       authMode;
-    tLimMlmAuthReq     *pMlmAuthReq;
-    tpSirSmeAuthReq    pSirSmeAuthReq;
-    tSirResultCodes    retCode = eSIR_SME_SUCCESS;
-    tpPESession        psessionEntry;
-    tANI_U8            sessionId;
-
-    
-    if(pMsgBuf == NULL)
-    {
-        limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
-           return;
-    }
-
-    pSirSmeAuthReq = (tpSirSmeAuthReq) pMsgBuf;
-
-    if((psessionEntry = peFindSessionByBssid(pMac,pSirSmeAuthReq->bssId,&sessionId))== NULL)
-    {
-        limLog(pMac, LOGE,FL("Session Does not exist for given BssId\n"));
-        return;
-    }
-
-    if (!limIsSmeAuthReqValid(pSirSmeAuthReq))
-    {
-        limLog(pMac, LOGW,
-               FL("received invalid SME_AUTH_REQ message\n"));
-
-        /// Send AUTH failure response to host
-        retCode = eSIR_SME_INVALID_PARAMETERS;
-        goto end;
-    }
-
-    PELOG1(limLog(pMac, LOG1,
-           FL("RECEIVED AUTH_REQ\n"));)
-
-    /**
-     * Expect Auth request for STA in link established state
-     * or STA in IBSS mode in normal state.
-     */
-
-    if ((psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
-        (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) ||
-        ((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) &&
-         (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
-    {
-        if (pSirSmeAuthReq->authType == eSIR_AUTO_SWITCH)
-            authMode = eSIR_SHARED_KEY; // Try Shared Key first
-        else
-            authMode = pSirSmeAuthReq->authType;
-
-        // Trigger MAC based Authentication
-        if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAuthReq, sizeof(tLimMlmAuthReq)))
-        {
-            // Log error
-            limLog(pMac, LOGP,
-                   FL("call to palAllocateMemory failed for mlmAuthReq\n"));
-            return;
-        }
-
-        pMac->lim.gLimPreAuthType = pSirSmeAuthReq->authType;
-
-        psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
-        psessionEntry->limSmeState     = eLIM_SME_WT_PRE_AUTH_STATE;
-     MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
-
-        // Store channel specified in auth request.
-        // This will be programmed later by MLM.
-        pMac->lim.gLimPreAuthChannelNumber =
-                                    (tSirMacChanNum)
-                                    pSirSmeAuthReq->channelNumber;
-
-        palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
-                      (tANI_U8 *) &pSirSmeAuthReq->peerMacAddr,
-                      sizeof(tSirMacAddr));
-
-        palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmAuthReq->peerMacAddr,
-                      (tANI_U8 *) &pSirSmeAuthReq->peerMacAddr,
-                      sizeof(tSirMacAddr));
-
-        pMlmAuthReq->authType = authMode;
-        
-        /* Update PE session  Id */
-        pMlmAuthReq->sessionId = sessionId;
-
-        if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
-                      (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
-                            != eSIR_SUCCESS)
-        {
-            /**
-             * Could not get AuthFailureTimeout value from CFG.
-             * Log error.
-             */
-            limLog(pMac, LOGP,
-                   FL("could not retrieve AuthFailureTimeout value\n"));
-        }
-
-        limPostMlmMessage(pMac, LIM_MLM_AUTH_REQ, (tANI_U32 *) pMlmAuthReq);
-        return;
-    }
-    else
-    {
-        /// Should not have received eWNI_SME_AUTH_REQ
-        // Log the event
-        limLog(pMac, LOGE,
-               FL("received unexpected SME_AUTH_REQ in state %X\n"),psessionEntry->limSmeState);
-        limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
-
-        /// Send AUTH failure response to host
-        retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
-        goto end;
-    }
-
-end:
-    limSendSmeAuthRsp(pMac, retCode,
-                      pSirSmeAuthReq->peerMacAddr,
-                      pSirSmeAuthReq->authType,
-                      eSIR_MAC_UNSPEC_FAILURE_STATUS );
-
-} /*** end __limProcessSmeAuthReq() ***/
-#endif
-
-
 /**
  * __limProcessSmeReassocReq()
  *
@@ -1975,30 +1920,6 @@
         goto end;
     }
 
-#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
-    limCopyNeighborInfoToCfg(pMac,
-        psessionEntry->pLimReAssocReq->neighborBssList.bssList[0],
-        psessionEntry);
-
-    palCopyMemory( pMac->hHdd,
-             pMac->lim.gLimReassocBssId,
-             psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].bssId,
-             sizeof(tSirMacAddr));
-
-    pMac->lim.gLimReassocChannelId =
-         psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].channelId;
-
-    pMac->lim.gLimReassocBssCaps =
-    psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].capabilityInfo;
-
-    pMac->lim.gLimReassocTitanHtCaps = 
-        psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].titanHtCaps;
-
-    palCopyMemory( pMac->hHdd,
-    (tANI_U8 *) &pMac->lim.gLimReassocSSID,
-    (tANI_U8 *) &psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].ssId,
-    psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].ssId.length+1);
-#else
     palCopyMemory( pMac->hHdd,
              psessionEntry->limReAssocbssId,
              psessionEntry->pLimReAssocReq->bssDescription.bssId,
@@ -2007,12 +1928,15 @@
     psessionEntry->limReassocChannelId =
          psessionEntry->pLimReAssocReq->bssDescription.channelId;
 
+    psessionEntry->reAssocHtSupportedChannelWidthSet =
+         (psessionEntry->pLimReAssocReq->cbMode)?1:0;
+    psessionEntry->reAssocHtRecommendedTxWidthSet =
+         psessionEntry->reAssocHtSupportedChannelWidthSet;
+    psessionEntry->reAssocHtSecondaryChannelOffset =
+         psessionEntry->pLimReAssocReq->cbMode;
+
     psessionEntry->limReassocBssCaps =
                 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
-
-    psessionEntry->limReassocTitanHtCaps =
-            psessionEntry->pLimReAssocReq->bssDescription.titanHtCaps;
-    
     regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel ); 
     localPowerConstraint = regMax;
     limExtractApCapability( pMac,
@@ -2057,8 +1981,6 @@
         limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x\n"), pMac->lim.gUapsdPerAcBitmask);
     }
 
-#endif
-
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq, sizeof(tLimMlmReassocReq)))
     {
         // Log error
@@ -2146,7 +2068,7 @@
     psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
     psessionEntry->limSmeState    = eLIM_SME_WT_REASSOC_STATE;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
 
     limPostMlmMessage(pMac,
                       LIM_MLM_REASSOC_REQ,
@@ -2243,7 +2165,7 @@
     }
 
 
-    PELOGE(limLog(pMac, LOGE,   FL("received DISASSOC_REQ message. Reason: %d SmeState: %d\n"), 
+    PELOGE(limLog(pMac, LOGE,   FL("received DISASSOC_REQ message. Reason: %d global SmeState: %d\n"), 
                                                         smeDisassocReq.reasonCode, pMac->lim.gLimSmeState);)
 
 
@@ -2275,7 +2197,7 @@
                 case eLIM_SME_LINK_EST_STATE:
                     psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
                     psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
-                      MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+                    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
                     break;
 
                 case eLIM_SME_WT_DEAUTH_STATE:
@@ -2285,7 +2207,7 @@
                      * its been set when PE entered WT_DEAUTH_STATE. 
                      */                  
                     psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
-                    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+                    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
                     limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DEAUTH_STATE. \n"));
                     break;
 
@@ -2611,7 +2533,7 @@
                 case eLIM_SME_IDLE_STATE:
                     psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
                     psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
-              MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+              MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
 
                     // Send Deauthentication request to MLM below
 
@@ -3040,178 +2962,6 @@
     palFreeMemory( pMac->hHdd, pRemoveKeyReq);
 } /*** end __limProcessSmeRemoveKeyReq() ***/
 
-
-
-#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
-/**
- * __limHandleSmeSwitchChlRequest()
- *
- *FUNCTION:
- *  This function is called to process the following SME messages
- *  received from HDD or WSM:
- *      - eWNI_SME_SWITCH_CHL_REQ
- *      - eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ
- *      - eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ
- *
- *ASSUMPTIONS:
- *
- *  eWNI_SME_SWITCH_CHL_REQ is issued only when 11h is enabled,
- *  and WSM wishes to switch its primary channel. AP shall
- *  populate the 802.11h channel switch IE in its Beacons/Probe Rsp.
- *
- *  eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ is issued only when 11h is enabled,
- *  and WSM wishes to switch both its primary channel and secondary channel.
- *  (In the case of if 11h is disabled, and WSM wants to change both
- *  primary & secondary channel, then WSM should issue a restart-BSS). AP
- *  shall populate the 802.11h channel switch IE in its Beacons/Probe Rsp.
- *
- *  eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ is issued when WSM wishes to
- *  switch/disable only its secondary channel. This can occur when 11h
- *  is enabled or disabled. AP shall populate the airgo proprietary
- *  channel switch IE in its Beacons/Probe Rsp.
- *
- *NOTE:
- *
- * @param  pMac      Pointer to Global MAC structure
- * @param  *pMsgBuf  A pointer to the SME message buffer
- * @return None
- */
-
-static void
-__limHandleSmeSwitchChlRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
-{
-    tpSirSmeSwitchChannelReq   pSmeMsg;
-    eHalStatus                 status;
-
-#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
-    limDiagEventReport(pMac, WLAN_PE_DIAG_SWITCH_CHL_REQ_EVENT, NULL, 0, 0);
-#endif //FEATURE_WLAN_DIAG_SUPPORT
-    
-    if(pMsgBuf == NULL)
-    {
-        limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
-           return;
-    }
-
-    if (pMac->lim.gLimSmeState != eLIM_SME_NORMAL_STATE ||
-            pMac->lim.gLimSystemRole != eLIM_AP_ROLE ||
-            pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
-    {
-        PELOGE(limLog(pMac, LOGE, "Rcvd Switch Chl Req in wrong state\n");)
-        limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_CHANNEL_SWITCH_FAIL);
-        return;
-    }
-                
-    status = palAllocateMemory( pMac->hHdd, (void **)&pSmeMsg, sizeof(tSirSmeSwitchChannelReq));
-    if( eHAL_STATUS_SUCCESS != status)
-    {
-        PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed, status = %d\n"), status);)
-        return;
-    }
-
-    if (!limIsSmeSwitchChannelReqValid(pMac, (tANI_U8 *)pMsgBuf, pSmeMsg))
-    {
-        limLog(pMac, LOGE,
-            FL("invalid sme message received\n"));
-        palFreeMemory( pMac->hHdd, pSmeMsg);
-        limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_INVALID_PARAMETERS);
-        return;
-    }
-
-
-    /* If we're already doing channel switching and we're in the
-     * middle of counting down, then reject this channel switch msg.
-     */
-    if (pMac->lim.gLimChannelSwitch.state != eLIM_CHANNEL_SWITCH_IDLE)
-    {
-        limLog(pMac, LOGE,
-            FL("channel switching is already in progress.\n"));
-        palFreeMemory( pMac->hHdd, pSmeMsg);
-        limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_CHANNEL_SWITCH_DISABLED);
-        return;
-    }
-
-    PELOG1(limLog(pMac, LOG1, FL("rcvd eWNI_SME_SWITCH_CHL_REQ, message type = %d\n"), pSmeMsg->messageType);)
-    switch(pSmeMsg->messageType)
-    {
-        case eWNI_SME_SWITCH_CHL_REQ:
-            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
-            break;
-
-        case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
-
-            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
-            break;
-
-        case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
-            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_SECONDARY_ONLY;
-            break;
-
-        default:
-            PELOGE(limLog(pMac, LOGE, FL("unknown message\n"));)
-            palFreeMemory( pMac->hHdd, pSmeMsg);
-            limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_INVALID_PARAMETERS);
-            return;
-    }
-
-    pMac->lim.gLimChannelSwitch.primaryChannel = pSmeMsg->channelId;
-    pMac->lim.gLimChannelSwitch.secondarySubBand = pSmeMsg->cbMode;
-    pMac->lim.gLimChannelSwitch.switchCount = computeChannelSwitchCount(pMac, pSmeMsg->dtimFactor);
-    if (LIM_IS_RADAR_DETECTED(pMac))
-    {
-        /** Measurement timers not running */
-        pMac->lim.gLimChannelSwitch.switchMode = eSIR_CHANSW_MODE_SILENT;
-    }
-    else
-    {
-        /** Stop measurement timers till channel switch */
-        limStopMeasTimers(pMac);
-        pMac->lim.gLimChannelSwitch.switchMode = eSIR_CHANSW_MODE_NORMAL;
-    }
-
-    PELOG1(limLog(pMac, LOG1, FL("state %d, primary %d, subband %d, count %d \n"),
-           pMac->lim.gLimChannelSwitch.state,
-           pMac->lim.gLimChannelSwitch.primaryChannel,
-           pMac->lim.gLimChannelSwitch.secondarySubBand,
-           pMac->lim.gLimChannelSwitch.switchCount);)
-    palFreeMemory( pMac->hHdd, pSmeMsg);
-    
-    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
-    pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
-    
-    return;
-} /*** end __limHandleSmeSwitchChlRequest() ***/
-
-
-/**--------------------------------------------------------------
-\fn     __limProcessSmeSwitchChlReq
-
-\brief  Wrapper for the function __limHandleSmeSwitchChlRequest
-        This message will be defered until softmac come out of
-        scan mode.
-\param  pMac
-\param  pMsg
-
-\return TRUE - If we consumed the buffer
-        FALSE - If have defered the message.
- ---------------------------------------------------------------*/
-static tANI_BOOLEAN
-__limProcessSmeSwitchChlReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
-{
-    if (__limIsDeferedMsgForLearn(pMac, pMsg))
-    {
-        /**
-                * If message defered, buffer is not consumed yet.
-                * So return false
-                */
-        return eANI_BOOLEAN_FALSE;
-    }
-    __limHandleSmeSwitchChlRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
-    return eANI_BOOLEAN_TRUE;
-}
-#endif
-
-
 void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
     tSirMsgQ         mmhMsg;
@@ -3262,7 +3012,7 @@
     mmhMsg.bodyval = 0;
   
     pMac->lim.gLimRspReqd = false;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 }
 
@@ -3581,7 +3331,7 @@
     prevState = psessionEntry->limSmeState;
 
     psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
 
     /* Update SME session Id and Transaction Id */
     psessionEntry->smeSessionId = smesessionId;
@@ -3609,7 +3359,7 @@
         PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d\n"), psessionEntry->bssIdx);)
         psessionEntry->limSmeState= prevState;
 
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
    
         limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
     }
@@ -4258,7 +4008,7 @@
         limLog(pMac, LOGP, FL("AddtsRsp timer change failed!\n"));
         return;
     }
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_ADDTS_RSP_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
     
     //add the sessionId to the timer object
     pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
@@ -4441,6 +4191,7 @@
     if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
     {
         limLog(pMac, LOGE, FL("session does not exist for given bssId\n"));
+        palFreeMemory( pMac, pMsgBuf );
         return;
     }
 
@@ -4482,10 +4233,11 @@
     msgQ.reserved = 0;
     msgQ.bodyptr = pMsgBuf;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
     if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
         limLog(pMac, LOGP, "Unable to forward request\n");
+        palFreeMemory( pMac, pMsgBuf );
         return;
     }
 
@@ -4530,7 +4282,7 @@
     msgQ.reserved = 0;
     msgQ.bodyptr = pMsgBuf;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
 
     if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
         palFreeMemory( pMac, pMsgBuf );
@@ -4866,7 +4618,7 @@
    msg.bodyval = 0;
 
    PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL\n"));)
-      MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+      MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
 
    if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
    {
@@ -4916,7 +4668,7 @@
    msg.bodyval = 0;
 
    PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL\n"));)
-      MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+      MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
 
    if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
    {
@@ -4952,9 +4704,8 @@
     tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
     tANI_BOOLEAN match = VOS_FALSE;
     PELOG1(limLog(pMac, LOG1, 
-           FL("%s: registerFrame %d, frameType %d, matchLen %d\n", 
-           __func__, pSmeReq->registerFrame, pSmeReq->frameType, 
-       pSmeReq->matchLen)));
+           FL("registerFrame %d, frameType %d, matchLen %d\n"), 
+            pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
 
     /* First check whether entry exists already*/
 
@@ -5056,7 +4807,7 @@
     tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
     tANI_U32 *pMsgBuf = pMsg->bodyptr;
 
-    PELOG1(limLog(pMac, LOG1, FL("LIM Received SME Message %s(%d) LimSmeState:%s(%d) LimMlmState: %s(%d)\n"),
+    PELOG1(limLog(pMac, LOG1, FL("LIM Received SME Message %s(%d) Global LimSmeState:%s(%d) Global LimMlmState: %s(%d)\n"),
          limMsgStr(pMsg->type), pMsg->type,
          limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
          limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
@@ -5081,6 +4832,12 @@
 
             break;
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+        case eWNI_SME_OEM_DATA_REQ:
+            __limProcessSmeOemDataReq(pMac, pMsgBuf);
+
+            break;
+#endif
 #ifdef WLAN_FEATURE_P2P
         case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
             bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
diff --git a/CORE/MAC/src/pe/lim/limPropExtsUtils.c b/CORE/MAC/src/pe/lim/limPropExtsUtils.c
index cfd824f..2419782 100644
--- a/CORE/MAC/src/pe/lim/limPropExtsUtils.c
+++ b/CORE/MAC/src/pe/lim/limPropExtsUtils.c
@@ -33,7 +33,6 @@
  * --------------------------------------------------------------------
  *
  */
-
 #include "aniGlobal.h"
 #ifdef ANI_PRODUCT_TYPE_AP
 #include "wniCfgAp.h"
@@ -55,7 +54,6 @@
 #include "limSerDesUtils.h"
 #include "limTrace.h"
 #include "limSession.h"
-
 #define LIM_GET_NOISE_MAX_TRY 5
 #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
 /**
@@ -82,11 +80,9 @@
 limGetCurrentLearnChannel(tpAniSirGlobal pMac)
 {
     tANI_U8 *pChanNum = pMac->lim.gpLimMeasReq->channelList.channelNumber;
-
     return (*(pChanNum + pMac->lim.gLimMeasParams.nextLearnChannelId));
 } /*** end limGetCurrentLearnChannel() ***/
 #endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
-
 /**
  * limExtractApCapability()
  *
@@ -107,7 +103,6 @@
  * @param   qosCap    Bits are set according to capabilities
  * @return  0 - If AP does not assert HCF capability & 1 - otherwise
  */
-
 void
 limExtractApCapability(tpAniSirGlobal pMac, tANI_U8 *pIE, tANI_U16 ieLen,
                        tANI_U8 *qosCap, tANI_U16 *propCap, tANI_U8 *uapsd, 
@@ -118,13 +113,10 @@
 #if !defined WLAN_FEATURE_VOWIFI
     tANI_U32            localPowerConstraints = 0;
 #endif
-
     palZeroMemory( pMac->hHdd, (tANI_U8 *) &beaconStruct, sizeof(beaconStruct));
-
     *qosCap = 0;
     *propCap = 0;
     *uapsd = 0;
-
     PELOG3(limLog( pMac, LOG3,
         FL("In limExtractApCapability: The IE's being received are:\n"));
     sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
@@ -146,10 +138,24 @@
         else
             pMac->lim.htCapabilityPresentInBeacon = 0;
 
+#ifdef WLAN_FEATURE_11AC
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL,
+            "***beacon.VHTCaps.present*****=%d\n",beaconStruct.VHTCaps.present);
+
+        if ( beaconStruct.VHTCaps.present && beaconStruct.VHTOperation.present)
+        {
+            pMac->lim.vhtCapabilityPresentInBeacon = 1;
+            pMac->lim.apCenterChan = beaconStruct.VHTOperation.chanCenterFreqSeg1;
+            pMac->lim.apChanWidth = beaconStruct.VHTOperation.chanWidth;
+        }
+        else
+        {
+            pMac->lim.vhtCapabilityPresentInBeacon = 0;
+        }
+#endif
         // Extract the UAPSD flag from WMM Parameter element
         if (beaconStruct.wmeEdcaPresent)
             *uapsd = beaconStruct.edcaParams.qosInfo.uapsd;
-
 #if defined FEATURE_WLAN_CCX
         /* If there is Power Constraint Element specifically,
          * adapt to it. Hence there is else condition check
@@ -160,12 +166,15 @@
             *localConstraint = beaconStruct.ccxTxPwr.power_limit;
         }
 #endif
-
-        if (beaconStruct.powerConstraintPresent && ( pMac->lim.gLim11hEnable
+        if (beaconStruct.powerConstraintPresent)
+#if 0
+        //Remove this check. This function is expected to return localPowerConsraints
+        //and it should just do that. Check for 11h enabled or not can be done at the caller
 #if defined WLAN_FEATURE_VOWIFI
-                 || pMac->rrm.rrmPEContext.rrmEnable
+          && ( pMac->lim.gLim11hEnable
+           || pMac->rrm.rrmPEContext.rrmEnable
 #endif
-                 ))
+#endif
         {
 #if defined WLAN_FEATURE_VOWIFI 
            *localConstraint -= beaconStruct.localPowerConstraint.localPowerConstraints;
@@ -173,7 +182,6 @@
            localPowerConstraints = (tANI_U32)beaconStruct.localPowerConstraint.localPowerConstraints;
 #endif
         }
-
 #if !defined WLAN_FEATURE_VOWIFI
         if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, localPowerConstraints) != eSIR_SUCCESS)
         {
@@ -181,12 +189,9 @@
         }
 #endif
     }
-
     return;
 } /****** end limExtractApCapability() ******/
 
-
-
 #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
 /**
  * limQuietBss()
@@ -210,18 +215,14 @@
  * @param   duration  Specifies quiet duration in millisec
  * @return  None
  */
-
 void
 limQuietBss(tpAniSirGlobal pMac, tANI_U32 duration)
 {
-
     // Temporarily not quieting BSS
     (void) pMac; (void) duration;
     return;
 } /****** end limQuietBss() ******/
 
-
-
 /**
  * limIsMatrixNodePresent()
  *
@@ -240,16 +241,13 @@
  * @param   pMac  - Pointer to Global MAC structure
  * @return  pNode - Pointer to Matrix node if found. Else NULL
  */
-
 static tpLimMeasMatrixNode
 limIsMatrixNodePresent(tpAniSirGlobal pMac)
 {
     tANI_U8   i, chanNum = limGetCurrentLearnChannel(pMac);
     tpLimMeasMatrixNode pNode = pMac->lim.gpLimMeasData->pMeasMatrixInfo;
-
     if (!pNode)
         return NULL;
-
     for (i = 0; i < pMac->lim.gpLimMeasReq->channelList.numChannels; i++)
     {
         if (pNode->matrix.channelNumber == chanNum)
@@ -264,12 +262,9 @@
                 break;
         }
     }
-
     return NULL;
 } /****** end limIsMatrixNodePresent() ******/
 
-
-
 /**
  * limGetMatrixNode()
  *
@@ -289,13 +284,11 @@
  * @param   pMac      Pointer to Global MAC structure
  * @return  None
  */
-
 static tpLimMeasMatrixNode
 limGetMatrixNode(tpAniSirGlobal pMac)
 {
     tpLimMeasMatrixNode       pNewMatrix;
     eHalStatus          status;
-
     pNewMatrix = limIsMatrixNodePresent(pMac);
     if (!pNewMatrix)
     {
@@ -310,7 +303,6 @@
                FL("palAllocateMemory failed for new measMatrix Node\n"));
             return NULL;
         }
-
         status = palZeroMemory( pMac->hHdd, (void *)pNewMatrix, sizeof(*pNewMatrix));
         if (status != eHAL_STATUS_SUCCESS)
         {
@@ -324,20 +316,15 @@
         pNewMatrix->matrix.channelNumber =
                                    limGetCurrentLearnChannel(pMac);
         pNewMatrix->avgRssi              = 0;
-
        PELOG3(limLog(pMac, LOG3, FL("Adding new Matrix info:channel#=%d\n"),
                pNewMatrix->matrix.channelNumber);)
-
         pNewMatrix->next = pMac->lim.gpLimMeasData->pMeasMatrixInfo;
         pMac->lim.gpLimMeasData->pMeasMatrixInfo = pNewMatrix;
         pMac->lim.gpLimMeasData->numMatrixNodes++;
     }
-
     return pNewMatrix;
 } /****** end limGetMatrixNode() ******/
 
-
-
 /**
  * limComputeAvg()
  *
@@ -358,7 +345,6 @@
  * @param   newVal    New averaged value
  * @return  None
  */
-
 tANI_U32
 limComputeAvg(tpAniSirGlobal pMac, tANI_U32 oldVal, tANI_U32 newVal)
 {
@@ -367,8 +353,6 @@
                       pMac->lim.gLimMeasParams.rssiAlpha));
 } /****** end limComputeAvg() ******/
 
-
-
 /**
  * limCollectRSSI()
  *
@@ -387,13 +371,11 @@
  * @param   pMac      Pointer to Global MAC structure
  * @return  None
  */
-
 void
 limCollectRSSI(tpAniSirGlobal pMac)
 {
     tpLimMeasMatrixNode  pNewMatrix = limGetMatrixNode(pMac);
     tANI_U32 i, noise;
-
     for (i = 0; i < LIM_GET_NOISE_MAX_TRY; i++)
         if ((noise = halGetNoise(pMac)) != HAL_NOISE_INVALID)
         {
@@ -404,17 +386,14 @@
         }
 } /****** end limCollectRSSI() ******/
 
-
 /**----------------------------------------------------------------------------
 \fn        limGetNeighbourBssNode
-
 \brief    returns neighbour bss node if it is already present in the list.
 \param pMac
 \param bssid - Bssid of new beacon or data packet.
 \param pSsId - Pointer to SSID of new packet.
 \param nwType - 11b/g/a
 \param chanId - Channel in which we received the packet.
-
 \return tpLimNeighborBssWdsNode or NULL
 -------------------------------------------------------------------------------*/
 static tpLimNeighborBssWdsNode
@@ -422,7 +401,6 @@
                                             tSirNwType nwType, tpAniSSID pSsId, tANI_U8 type)
 {
     tpLimNeighborBssWdsNode pNode = pMac->lim.gpLimMeasData->pNeighborWdsInfo;
-
     while (pNode)
     {
         //Do we need to check for ssId also ?
@@ -448,17 +426,14 @@
 #endif
                 return pNode;
         }
-
         if (!pNode->next)
             break;
         else
             pNode = pNode->next;
     }
-
     return NULL;
 }
 
-
 /**
  * limCollectMeasurementData()
  *
@@ -479,7 +454,6 @@
  * @param  pBeacon  - Pointer to parsed BSS info
  * @return None
  */
-
 void
 limCollectMeasurementData(tpAniSirGlobal pMac,
                           tANI_U32 *pRxPacketInfo, tpSchBeaconStruct pBeacon)
@@ -496,10 +470,8 @@
     tpLimMeasMatrixNode     pNewMatrix;
     eHalStatus status;
     tpSirMacMgmtHdr       pHdr;
-
    PELOG3(limLog(pMac, LOG3, FL("Collecting measurement data for RadioId %d\n"),
            pMac->sys.gSirRadioId);)
-
     tANI_U32 ignore = 0;
     limGetBssidFromBD(pMac, (tpHalBufDesc) pRxPacketInfo, bssIdRcv, &ignore);
     if (palEqualMemory( pMac->hHdd, bssIdRcv, pMac->lim.gLimBssid, sizeof(tSirMacAddr)))
@@ -509,7 +481,6 @@
     }
     pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
     fc = pHdr->fc;
-
     if (fc.type == SIR_MAC_DATA_FRAME)
     {
         PELOG2(limLog(pMac, LOG2, FL("Received DATA packet\n"));)
@@ -524,7 +495,6 @@
         chanId = limGetChannelFromBeacon(pMac, pBeacon);
         ieLen = pBeacon->wpa.length + pBeacon->propIEinfo.wdsLength;
     }
-
     if (chanId == 0)
     {
       /* If the channel Id is not retrieved from Beacon, extract the channel from BD */
@@ -536,30 +506,24 @@
            chanId = pMac->lim.gLimCurrentScanChannelId;
       }
     }
-
     /*
      * Now always returns nwType as 11G for data packets - FIXIT
      */
     nwType = limGetNwType(pMac, chanId, fc.type, pBeacon);
-
     pNewMatrix = limGetMatrixNode(pMac);
     /** LOGP would result in freeing all dynamicall allocated memories. So
       *  return from here if limGetMatrixNode returns NULL
       */
     if (!pNewMatrix)
         return;
-
     pNewMatrix->matrix.aggrRssi += WDA_GET_RX_RSSI_DB(pRxPacketInfo);
     pNewMatrix->matrix.totalPackets++;
-
     // Find if this neighbor is already 'learned'
     // If found, update its information.
     pNode = limGetNeighbourBssNode(pMac, bssIdRcv, chanId, nwType, &ssId, fc.type);
-
     if (!pNode)
     {
         realLen = sizeof(tSirNeighborBssWdsInfo);
-
         /** Newly discovered neighbor. Inform WSM of this
           * and add this BSS info at the beginning
           * Need to limit the number newly discovered BSS added
@@ -570,14 +534,12 @@
                  sizeof(tSirMeasMatrixInfo)));
        PELOG2(limLog(pMac, LOG2, FL("Current BSS length %d, Real length %d\n"),
                 pMac->lim.gpLimMeasData->totalBssSize, realLen);)
-
         /** Check if we have enough room for adding a new node.
           */
         if (pMac->lim.gpLimMeasData->totalBssSize + realLen < len)
         {
             pMac->lim.gpLimMeasData->numBssWds++;
             pMac->lim.gpLimMeasData->totalBssSize += realLen;
-
             PELOG2(limPrintMacAddr(pMac, bssIdRcv, LOG2);)
         }
         else
@@ -585,20 +547,17 @@
             PELOG2(limLog(pMac, LOG2, FL("Dropping the measurement packets: No memory!\n"));)
             return;
     }
-
         /** Allocate max memory required even if the packet is of type DATA,
           * So that next time we receive a beacon, won't run out of memory to
           * update the information.
           */
         allocLen = sizeof(tLimNeighborBssWdsNode) + 4 + ieLen;
         status = palAllocateMemory( pMac->hHdd, (void **)&pNode, allocLen);
-
     if (status != eHAL_STATUS_SUCCESS)
     {
             limLog(pMac, LOGP, FL("palAllocateMemory failed for new NeighborBssWds Node\n"));
         return;
     }
-
         status = palZeroMemory(pMac->hHdd, pNode, allocLen);
         if (status != eHAL_STATUS_SUCCESS)
         {
@@ -609,13 +568,11 @@
         pMac->lim.gpLimMeasData->pNeighborWdsInfo = pNode;
         found = eANI_BOOLEAN_FALSE;
     }
-
     pNode->info.neighborBssInfo.rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
     pNode->info.neighborBssInfo.aggrRssi += pNode->info.neighborBssInfo.rssi;
     if (fc.type == SIR_MAC_DATA_FRAME)
         pNode->info.neighborBssInfo.dataCount++;
     pNode->info.neighborBssInfo.totalPackets++;
-
     /** If node not found or previous learn was not from a beacon/probe rsp
       * then learn again.
       */
@@ -630,12 +587,10 @@
         // Data frame received from other BSS.
         // Collect as much information as possible
             pNode->info.neighborBssInfo.wniIndicator = (tAniBool) 0;
-
         if (fc.toDS || fc.fromDS)
                 pNode->info.neighborBssInfo.bssType = eSIR_INFRASTRUCTURE_MODE;
         else
                 pNode->info.neighborBssInfo.bssType = eSIR_IBSS_MODE;
-
             pNode->info.neighborBssInfo.load.numStas = 0;
             pNode->info.neighborBssInfo.load.channelUtilization = 0;
             pNode->info.neighborBssInfo.ssId.length = 0;
@@ -645,19 +600,6 @@
     }
     else
     {
-        //FIXME_CBMODE: need to seperate out TITAN and HT cb modes.
-        if(pBeacon->HTCaps.present)
-        {
-            limGetHtCbAdminState(pMac, pBeacon->HTCaps, 
-                        &pNode->info.neighborBssInfo.titanHtCaps);
-        
-            if( pBeacon->HTInfo.present)
-            {
-                    limGetHtCbOpState(pMac, pBeacon->HTInfo, 
-                            &pNode->info.neighborBssInfo.titanHtCaps);
-            }
-        }
-
         // This must be either Beacon frame or
         // Probe Response. Copy all relevant information.
             pNode->info.neighborBssInfo.wniIndicator = (tAniBool) pBeacon->propIEinfo.aniIndicator;
@@ -670,7 +612,6 @@
             pNode->info.neighborBssInfo.apName.length = pBeacon->propIEinfo.apName.length;
             palCopyMemory( pMac->hHdd, (tANI_U8 *) pNode->info.neighborBssInfo.apName.name,
                     pBeacon->propIEinfo.apName.name, pBeacon->propIEinfo.apName.length);
-
             pNode->info.neighborBssInfo.rsnIE.length = 0;
             // Add WPA2 information. Before that make sure that memory is available
             if (pBeacon->rsnPresent && (pBeacon->rsn.length < SIR_MAC_MAX_IE_LENGTH))
@@ -680,12 +621,10 @@
                 pNode->info.neighborBssInfo.rsnIE.rsnIEdata[1] = pBeacon->rsn.length;
                 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pNode->info.neighborBssInfo.rsnIE.rsnIEdata[2],
                         pBeacon->rsn.info, pBeacon->rsn.length);
-
                PELOG2(limLog(pMac, LOG2, FL("NeighborBss RSN IE, type=%x, length=%x\n"), 
                         pNode->info.neighborBssInfo.rsnIE.rsnIEdata[0],
                         pNode->info.neighborBssInfo.rsnIE.rsnIEdata[1]);)
             }
-
             // Add WPA information. Before that make sure that memory is available
             if (pBeacon->wpaPresent && ((pBeacon->rsn.length + pBeacon->wpa.length) < (SIR_MAC_MAX_IE_LENGTH-2)))
             {
@@ -693,11 +632,9 @@
                     SIR_MAC_WPA_EID;
                 pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length + 1] =
                     pBeacon->wpa.length;
-
                 palCopyMemory( pMac->hHdd,
                         (tANI_U8 *) &pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length + 2],
                         pBeacon->wpa.info, pBeacon->wpa.length);
-
                PELOG2(limLog(pMac, LOG2, FL("NeighborBss WPA IE, type=%x, length=%x\n"),
                         pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length],
                         pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length + 1]);)
@@ -707,28 +644,23 @@
             palCopyMemory( pMac->hHdd, (tANI_U8 *) pNode->info.wdsInfo.wdsBytes,
                       pBeacon->propIEinfo.wdsData,
                       pBeacon->propIEinfo.wdsLength);
-
             pNode->info.neighborBssInfo.capabilityInfo = *((tANI_U16*)&pBeacon->capabilityInfo);
-
 #if 0
             if (pBeacon->HTCaps.present)
                 palCopyMemory( pMac->hHdd, (tANI_U8 *)&pNode->info.neighborBssInfo.HTCaps,
                         (tANI_U8 *)&pBeacon->HTCaps, HT_CAPABILITY_IE_SIZE);
         else
                 pNode->info.neighborBssInfo.HTCaps.present = 0;
-
             if (pBeacon->HTInfo.present)
                 palCopyMemory( pMac->hHdd, (tANI_U8 *)&pNode->info.neighborBssInfo.HTInfo,
                         (tANI_U8 *)&pBeacon->HTInfo, HT_INFO_IE_SIZE);
         else
                 pNode->info.neighborBssInfo.HTInfo.present = 0;
 #endif
-
             if (pBeacon->suppRatesPresent && (pBeacon->supportedRates.numRates <= 
                                               SIR_MAC_RATESET_EID_MAX))
             {
                 pNode->info.neighborBssInfo.operationalRateSet.numRates = pBeacon->supportedRates.numRates;
-
                PELOG4(limLog(pMac, LOG4, FL("Supported Rates (%d) : "),
                         pNode->info.neighborBssInfo.operationalRateSet.numRates);)
                 for (i=0; i<pBeacon->supportedRates.numRates; i++)
@@ -738,12 +670,10 @@
                 }
                 PELOG4(limLog(pMac, LOG4, FL("\n"));)
             }
-
             if (pBeacon->extendedRatesPresent && (pBeacon->extendedRates.numRates <= 
                                                   SIR_MAC_RATESET_EID_MAX))
             {
                 pNode->info.neighborBssInfo.extendedRateSet.numRates = pBeacon->extendedRates.numRates;
-
                PELOG4(limLog(pMac, LOG4, FL("Extended Rates (%d) : "),
                         pNode->info.neighborBssInfo.extendedRateSet.numRates);)
                 for (i=0; i<pBeacon->extendedRates.numRates; i++)
@@ -770,7 +700,6 @@
         }
     }
 } /****** end limCollectMeasurementData() ******/
-
 /**
  * limCleanupMatrixNodes()
  *
@@ -789,7 +718,6 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
-
 static void
 limCleanupMatrixNodes(tpAniSirGlobal pMac)
 {
@@ -797,26 +725,21 @@
     {
         tpLimMeasMatrixNode pNode = pMac->lim.gpLimMeasData->pMeasMatrixInfo;
         tpLimMeasMatrixNode pNext;
-
       while (pNode)
       {
             pNext = pNode->next;
             palFreeMemory( pMac->hHdd, pNode);
-
             if (pNext)
                 pNode = pNext;
             else
               break;
           }
       }
-
     pMac->lim.gpLimMeasData->numMatrixNodes = 0;
          PELOG2(limLog(pMac, LOG2,
            FL("Cleaned up channel matrix nodes\n"));)
-
     pMac->lim.gpLimMeasData->pMeasMatrixInfo = NULL;
 } /****** end limCleanupMatrixNodes() ******/
-
 /**
  * limCleanupNeighborBssNodes()
  *
@@ -835,7 +758,6 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
-
 static void
 limCleanupNeighborBssNodes(tpAniSirGlobal pMac)
 {
@@ -849,23 +771,19 @@
             pNext = pNode->next;
             pMac->lim.gpLimMeasData->numBssWds--;
             palFreeMemory( pMac->hHdd, pNode);
-
             if (pNext)
                 pNode = pNext;
             else
                 break;
         }
     }
-
    PELOG2(limLog(pMac, LOG2,
            FL("Cleaned up neighbor nodes\n"));)
-
     pMac->lim.gpLimMeasData->numBssWds        = 0;
     pMac->lim.gpLimMeasData->totalBssSize     = 0;
     pMac->lim.gpLimMeasData->pNeighborWdsInfo = NULL;
 } /****** end limCleanupNeighborBssNodes() ******/
 
-
 /**
  * limSendSmeMeasurementInd()
  *
@@ -882,32 +800,27 @@
  * @param  pMac - Pointer to Global MAC structure
  * @return None
  */
-
 void
 limSendSmeMeasurementInd(tpAniSirGlobal pMac)
 {
     tANI_U8          *pMeasInd;
     tANI_U16         len = 0;
     tSirMsgQ    mmhMsg;
-
 #ifdef GEN6_TODO
     //fetch the sessionEntry based on the sessionId
     //priority - MEDIUM
     tpPESession sessionEntry;
-
     if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.gLimMeasParams.measurementIndTimer.sessionId))== NULL) 
     {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
         return;
     }
 #endif
-
     if (!pMac->sys.gSysEnableLearnMode ||
         (pMac->lim.gpLimMeasReq == NULL))
     {
         return;
     }
-
     len = sizeof(tSirSmeMeasurementInd) +
           (pMac->lim.gpLimMeasReq->channelList.numChannels *
            sizeof(tSirMeasMatrixInfo)) +
@@ -921,37 +834,28 @@
                pMac->lim.gpLimMeasData->numBssWds,
                pMac->lim.gpLimMeasData->totalBssSize);
     }
-
     PELOG2(limLog(pMac, LOG2, FL("*****  Measurement IND size %d\n"), len);)
-
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMeasInd, len))
     {
         /// Buffer not available. Log error
         limLog(pMac, LOGP,
                FL("call to palAllocateMemory failed for eWNI_SME_MEAS_IND\n"));
-
         return;
     }
-
    PELOG3(limLog(pMac, LOG3,
        FL("Sending eWNI_SME_MEAS_IND on Radio %d, requested len=%d\n"),
        pMac->sys.gSirRadioId, len);)
-
     limMeasurementIndSerDes(pMac, pMeasInd);
-
     mmhMsg.type = eWNI_SME_MEASUREMENT_IND;
     mmhMsg.bodyptr = pMeasInd;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
-
     // Cleanup neighbor information
     limCleanupNeighborBssNodes(pMac);
     limCleanupMatrixNodes(pMac);
 } /*** end limSendSmeMeasurementInd() ***/
 
-
-
 /**
  * limCleanupMeasData()
  *
@@ -972,51 +876,40 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
-
 void
 limCleanupMeasData(tpAniSirGlobal pMac)
 {
     if (pMac->lim.gpLimMeasReq)
         palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasReq);
-
     pMac->lim.gpLimMeasReq = NULL;
-
     if (!pMac->lim.gpLimMeasData)
         return;
-
     if (pMac->lim.gpLimMeasData->pMeasMatrixInfo)
     {
         // Retain current channel's data and flush remaining
         tpLimMeasMatrixNode pMatrix =
                         (pMac->lim.gpLimMeasData->pMeasMatrixInfo)->next;
         tpLimMeasMatrixNode pNext;
-
         while (pMatrix)
         {
             pNext = pMatrix->next;
             palFreeMemory( pMac->hHdd, pMatrix);
-
             if (pNext)
                 pMatrix = pNext;
             else
                 break;
         }
-
         pMac->lim.gpLimMeasData->pMeasMatrixInfo->next = NULL;
     }
-
     pMac->lim.gpLimMeasData->numMatrixNodes = 0;
    PELOG2(limLog(pMac, LOG2,
            FL("Cleaned up measurement metrics nodes\n"));)
-
     // Cleanup neighbor information
     limCleanupNeighborBssNodes(pMac);
 } /****** end limCleanupMeasData() ******/
-
 /**---------------------------------------------------------
 \fn     limStopMeasTimers
 \brief  Stops all measurement related timers.
-
 \param  pMac
 \return None
  ----------------------------------------------------------*/
@@ -1025,7 +918,6 @@
 {
     if (pMac->lim.gpLimMeasReq == NULL)
         return;
-
     if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled)
     {
         if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.measurementIndTimer) != TX_SUCCESS)
@@ -1034,28 +926,25 @@
         }
     }
     pMac->lim.gLimMeasParams.isMeasIndTimerActive = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_LEARN_INTERVAL_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_LEARN_INTERVAL_TIMER));
     if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
     {
         PELOGE(limLog(pMac, LOGE, FL("Cannot stop learn interval timer\n"));)
     }
-
     if (pMac->lim.gLimSpecMgmt.fQuietEnabled)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_LEARN_DURATION_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_LEARN_DURATION_TIMER));
         if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
         {
             PELOGE(limLog(pMac, LOGE, FL("Cannot stop learn duration timer\n"));)
         }
     }
-
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_LEARN_DURATION_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_LEARN_DURATION_TIMER));
     if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
     {
         PELOGE(limLog(pMac, LOGE, FL("Cannot stop learn duration timer\n"));)
     }
 }
-
 /**
  * limDeleteMeasTimers()
  *
@@ -1073,7 +962,6 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
-
 void
 limDeleteMeasTimers(tpAniSirGlobal pMac)
 {
@@ -1083,8 +971,6 @@
     tx_timer_delete(&pMac->lim.gLimMeasParams.learnDurationTimer);
 } /*** end limDeleteMeasTimers() ***/
 
-
-
 /**
  * limCleanupMeasResources()
  *
@@ -1105,30 +991,24 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
-
 void
 limCleanupMeasResources(tpAniSirGlobal pMac)
 {
    PELOG1( limLog(pMac, LOG1,
            FL("Cleaning up Learn mode Measurement resources\n"));)
-
     if (pMac->lim.gpLimMeasReq == NULL)
         return;
-
     limDeleteMeasTimers(pMac);
-
     if (pMac->lim.gpLimMeasData)
     {
         limCleanupMeasData(pMac);
         if (pMac->lim.gpLimMeasData->pMeasMatrixInfo)
             palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasData->pMeasMatrixInfo);
-
         palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasData);
         pMac->lim.gpLimMeasData = NULL;
     }
 } /****** end limCleanupMeasResources() ******/
 
-
 /**
  * limDeleteCurrentBssWdsNode()
  *
@@ -1152,7 +1032,6 @@
 {
     tANI_U32                 cfg = sizeof(tSirMacAddr);
     tSirMacAddr         currentBssId;
-
 #if 0
     if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
                                 eSIR_SUCCESS)
@@ -1162,10 +1041,8 @@
     }
 #endif //TO SUPPORT BT-AMP
     sirCopyMacAddr(currentBssId,sessionEntry->bssId);
-
     if (!pMac->lim.gpLimMeasData)
         return;
-
     if (pMac->lim.gpLimMeasData->pNeighborWdsInfo)
     {
         tpLimNeighborBssWdsNode pNode =
@@ -1183,20 +1060,16 @@
                 break;
             }
             pPrev = pNode;
-
             if (pNode->next)
                 pNode = pNode->next;
             else
                 break;
         }
-
         if (!pMac->lim.gpLimMeasData->numBssWds)
             pMac->lim.gpLimMeasData->pNeighborWdsInfo = NULL;
     }
 } /****** end limDeleteCurrentBssWdsNode() ******/
 
-
-
 /**
  * limRestorePreLearnState()
  *
@@ -1215,61 +1088,23 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
-
 void
 limRestorePreLearnState(tpAniSirGlobal pMac)
 {
    PELOG4(limLog(pMac, LOG4,
            FL("Restoring from Learn mode on RadioId %d\n"),
            pMac->sys.gSirRadioId);)
-
     pMac->lim.gLimSystemInScanLearnMode = 0;
-
     // Go back to previous state.
     pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
     pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
-
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
    PELOG4(limLog(pMac, LOG4,
            FL("Restored from Learn mode on RadioId %d\n"),
            pMac->sys.gSirRadioId);)
 } /****** end limRestorePreLearnState() ******/
-
 #endif //#if (defined(ANI_PRODUCT_TYPE_AP) || (ANI_PRODUCT_TYPE_AP_SDK))
-
-/**
- * limGetPhyCBState
- *
- *FUNCTION:
- * Based on the current state of LIM, this routine determines
- * the correct PHY enumeration "ePhyChanBondState" to use
- *
- *LOGIC:
- * Is it possible to have a common enumeration?
- *
- *ASSUMPTIONS:
- *
- *NOTE:
- *
- * @param  pMac - Pointer to Global MAC structure
- * @return The corresponding PHY enumeration ePhyChanBondState
- */
-ePhyChanBondState limGetPhyCBState( tpAniSirGlobal pMac )
-{
-    ePhyChanBondState cbState = PHY_SINGLE_CHANNEL_CENTERED;
-
-    if( GET_CB_OPER_STATE( pMac->lim.gCbState ))
-    {
-      if( GET_CB_SEC_CHANNEL( pMac->lim.gCbState ))
-        cbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
-      else
-        cbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-    }
-  return cbState;
-}
-
-
 /**
  * limGetHTCBState
  *
@@ -1284,45 +1119,34 @@
  * @param  pMac - Pointer to Global MAC structure
  * @return The corresponding HT enumeration
  */
-
-tSirMacHTSecondaryChannelOffset    limGetHTCBState(tAniCBSecondaryMode aniCBMode) 
+ePhyChanBondState  limGetHTCBState(ePhyChanBondState aniCBMode) 
 {
-    if(aniCBMode == eANI_CB_SECONDARY_DOWN)
-        return eHT_SECONDARY_CHANNEL_OFFSET_DOWN;
-    else if(aniCBMode == eANI_CB_SECONDARY_UP)
-        return eHT_SECONDARY_CHANNEL_OFFSET_UP;
-    else
-        return eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+    switch ( aniCBMode )
+    {
+#ifdef WLAN_FEATURE_11AC
+        case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
+        case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
+        case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
+#endif
+        case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
+        return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
+#ifdef WLAN_FEATURE_11AC
+        case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
+        case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
+        case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
+#endif
+        case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
+        return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
+#ifdef WLAN_FEATURE_11AC
+        case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
+           return PHY_SINGLE_CHANNEL_CENTERED;
+#endif
+        default :
+           return PHY_SINGLE_CHANNEL_CENTERED;
+     }
 }
 
-
-/**
- * limGetAniCBState
- *
- *FUNCTION:
- * This routing provides the translation of HT Enum to Airgo enum for determining 
- * secondary channel offset.
- * Airgo Enum is required for backward compatibility purposes.
- *
- *
- *NOTE:
- *
- * @param  pMac - Pointer to Global MAC structure
- * @return The corresponding ANI enumeration
- */
-
-tAniCBSecondaryMode     limGetAniCBState( tSirMacHTSecondaryChannelOffset htCBMode) 
-{
-    if(eHT_SECONDARY_CHANNEL_OFFSET_DOWN == htCBMode)
-        return eANI_CB_SECONDARY_DOWN;
-    else if(eHT_SECONDARY_CHANNEL_OFFSET_UP == htCBMode)
-        return eANI_CB_SECONDARY_UP;
-    else
-        return eANI_CB_SECONDARY_NONE;
-}
-
-
-/**
+ /*
  * limGetStaPeerType
  *
  *FUNCTION:
@@ -1347,7 +1171,6 @@
     tpPESession   psessionEntry)
 {
 tStaRateMode staPeerType = eSTA_11b;
-
   // Determine the peer-STA type
   if( pStaDs->aniPeer )
   {
@@ -1358,118 +1181,16 @@
     else
         staPeerType = eSTA_POLARIS;
   }
+#ifdef WLAN_FEATURE_11AC
+  else if(pStaDs->mlmStaContext.vhtCapability)
+      staPeerType = eSTA_11ac;
+#endif
   else if(pStaDs->mlmStaContext.htCapability)
         staPeerType = eSTA_11n;
   else if(pStaDs->erpEnabled)
         staPeerType = eSTA_11bg;
   else if(psessionEntry->limRFBand == SIR_BAND_5_GHZ)
         staPeerType = eSTA_11a;
-
   return staPeerType;
 }
 
-/**
- * setupCBState()
- *
- *FUNCTION:
- * This function is called during eWNI_SME_START_BSS_REQ.
- * Based on the configured Channel Bonding mode, the
- * appropriate Channel Bonding state is setup in the global
- * LIM object - gCbState. This will then be subsequently used
- * in the proprietary IE field
- *
- *LOGIC:
- *
- *ASSUMPTIONS:
- *
- *NOTE:
- *
- * @param  pMac   Pointer to Global MAC structure
- * @param  cbMode The CB mode as set by SME (WSM)
- * @return None
- */
-void setupCBState( tpAniSirGlobal pMac,
-    tAniCBSecondaryMode cbMode )
-{
-
-  switch( cbMode )
-  {
-    case eANI_CB_SECONDARY_DOWN:
-      SET_CB_OPER_STATE( pMac->lim.gCbState, eHAL_SET );
-      SET_CB_SEC_CHANNEL( pMac->lim.gCbState, eHAL_CLEAR );
-      if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER) != eSIR_SUCCESS)
-          limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
-      // AU state is set via CFG
-      break;
-
-    case eANI_CB_SECONDARY_UP:
-      SET_CB_OPER_STATE( pMac->lim.gCbState, eHAL_SET );
-      SET_CB_SEC_CHANNEL( pMac->lim.gCbState, eHAL_SET );
-      if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER) != eSIR_SUCCESS)
-          limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
-      // AU state is set via CFG
-      break;
-
-    case eANI_CB_SECONDARY_NONE:
-      if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE) != eSIR_SUCCESS)
-          limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
-
-    default:
-      SET_CB_OPER_STATE( pMac->lim.gCbState, eHAL_CLEAR );
-      break;
-  }
-
-
-
-  limLog( pMac, LOG2,
-      FL("New CB State: 0x%1x for Mode %d\n"),
-      pMac->lim.gCbState,
-      cbMode );
-}
-
-/**
- * limGetCurrentCBSecChannel()
- *
- *FUNCTION:
- * This function is called to determine the current
- * "secondary" channel when Channel Bonding is enabled
- *
- *PARAMS:
- *
- *LOGIC:
- *
- *ASSUMPTIONS:
- * NA
- *
- *NOTE:
- * NA
- *
- * @param  pMac      Pointer to Global MAC structure
- * @return Channel number
- */
-tANI_U8 limGetCurrentCBSecChannel( tpAniSirGlobal pMac,tpPESession psessionEntry)
-{
-tANI_U8 chanNum;
-
-  //
-  // FIXME - This is a HACK!!
-  // Need to have a clean way of determining the current
-  // CB secondary channel!!
-  //
-  chanNum = psessionEntry->currentOperChannel;
-  if( GET_CB_OPER_STATE( pMac->lim.gCbState ))
-  {
-    if( GET_CB_SEC_CHANNEL( pMac->lim.gCbState ))
-      chanNum += 4;
-    else
-      chanNum -= 4;
-  }
-
-  limLog( pMac, LOG4,
-      FL("Returning CB Sec Channel %1d\n"),
-      chanNum );
-
-  return chanNum;
-}
-
-
diff --git a/CORE/MAC/src/pe/lim/limPropExtsUtils.h b/CORE/MAC/src/pe/lim/limPropExtsUtils.h
index 17f2da2..4294424 100644
--- a/CORE/MAC/src/pe/lim/limPropExtsUtils.h
+++ b/CORE/MAC/src/pe/lim/limPropExtsUtils.h
@@ -63,11 +63,11 @@
 // Determine if a newly discovered BSS is TITAN-compatible
 void handleNonTitanBss( tpAniSirGlobal, tSirNeighborBssWdsInfo );
 #endif
-ePhyChanBondState limGetPhyCBState( tpAniSirGlobal );
 tStaRateMode limGetStaPeerType( tpAniSirGlobal, tpDphHashNode ,tpPESession);
-void setupCBState( tpAniSirGlobal, tAniCBSecondaryMode );
+#ifdef WLAN_FEATURE_11AC
+ePhyChanBondState  limGetHTCBState(ePhyChanBondState aniCBMode) ;
+#endif
 
-tANI_U8 limGetCurrentCBSecChannel( tpAniSirGlobal,tpPESession );
 
 #endif /* __LIM_PROP_EXTS_UTILS_H */
 
diff --git a/CORE/MAC/src/pe/lim/limScanResultUtils.c b/CORE/MAC/src/pe/lim/limScanResultUtils.c
index a866152..ee76b57 100644
--- a/CORE/MAC/src/pe/lim/limScanResultUtils.c
+++ b/CORE/MAC/src/pe/lim/limScanResultUtils.c
@@ -75,7 +75,7 @@
             */
         
         limDeactivateAndChangeTimer(pMac,eLIM_MIN_CHANNEL_TIMER);
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_MAX_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)
         {
@@ -196,33 +196,6 @@
    }
 
     pBssDescr->channelIdSelf = rxChannel;
-    pBssDescr->titanHtCaps = 0;
-
-    //FIXME_CBMODE : need to seperate out TITAN and HT CB mode.
-    //HT neighbor with channel bonding
-    if( pBPR->HTCaps.present  )
-    {
-        tAniTitanHtCapabilityInfo titanHtCaps = 0;
-        limGetHtCbAdminState(pMac, pBPR->HTCaps, &titanHtCaps);
-        if( pBPR->HTInfo.present &&
-          pBPR->HTInfo.secondaryChannelOffset )
-        {
-
-            limGetHtCbOpState( pMac,
-                pBPR->HTInfo,
-                &titanHtCaps );
-        }
-        pBssDescr->titanHtCaps = (tANI_U32) titanHtCaps;
-    }
-
-    // Is this is a TITAN neighbor?
-    else if( pBPR->propIEinfo.aniIndicator &&
-        pBPR->propIEinfo.titanPresent )
-    {
-    tAniTitanHtCapabilityInfo titanHtCaps = 0;
-      pBssDescr->titanHtCaps = (tANI_U32) titanHtCaps;
-    }
-
     //set the network type in bss description
     channelNum = pBssDescr->channelId;
     pBssDescr->nwType = limGetNwType(pMac, channelNum, SIR_MAC_MGMT_FRAME, pBPR);
@@ -665,18 +638,20 @@
 
     for (pprev = ptemp; ptemp; pprev = ptemp, ptemp = ptemp->next)
     {
-        //For infrastructure, only check BSSID. For IBSS, check more
+        //For infrastructure, check BSSID and SSID. For IBSS, check more
         pSirCapTemp = (tSirMacCapabilityInfo *)&ptemp->bssDescription.capabilityInfo;
         if((pSirCapTemp->ess == pSirCap->ess) && //matching ESS type first
             (palEqualMemory( pMac->hHdd,(tANI_U8 *) pBssDescr->bssDescription.bssId,
                       (tANI_U8 *) ptemp->bssDescription.bssId,
                       sizeof(tSirMacAddr))) &&   //matching BSSID
-            ((pSirCapTemp->ess) ||    //we are done for infrastructure
-            //For IBSS, matching SSID, nwType and channelId
-            ((palEqualMemory( pMac->hHdd,((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1),
+            (pBssDescr->bssDescription.channelId ==
+                                      ptemp->bssDescription.channelId) &&
+            palEqualMemory( pMac->hHdd,((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1),
                            ((tANI_U8 *) &ptemp->bssDescription.ieFields + 1),
                            (tANI_U8) (ssidLen + 1)) &&
-            (pBssDescr->bssDescription.nwType ==
+            ((pSirCapTemp->ess) || //we are done for infrastructure
+            //For IBSS, nwType and channelId
+            (((pBssDescr->bssDescription.nwType ==
                                          ptemp->bssDescription.nwType) &&
             (pBssDescr->bssDescription.channelId ==
                                       ptemp->bssDescription.channelId))))
diff --git a/CORE/MAC/src/pe/lim/limSecurityUtils.c b/CORE/MAC/src/pe/lim/limSecurityUtils.c
index d1c774f..d7385ed 100644
--- a/CORE/MAC/src/pe/lim/limSecurityUtils.c
+++ b/CORE/MAC/src/pe/lim/limSecurityUtils.c
@@ -375,7 +375,7 @@
 limReleasePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthNode pAuthNode)
 {
     pAuthNode->fFree = 1;
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_PRE_AUTH_CLEANUP_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_PRE_AUTH_CLEANUP_TIMER));
     tx_timer_deactivate(&pAuthNode->timer);                
     pMac->lim.gLimNumPreAuthContexts--;
 } /*** end limReleasePreAuthNode() ***/
@@ -642,7 +642,7 @@
 
     sessionEntry->limMlmState = sessionEntry->limPrevMlmState;
     
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState));
 
 
     // 'Change' timer for future activations
@@ -1000,6 +1000,7 @@
  * A utility API to send MLM_REMOVEKEY_CNF to SME
  */
 void limPostSmeRemoveKeyCnf( tpAniSirGlobal pMac,
+    tpPESession psessionEntry,
     tLimMlmRemoveKeyReq *pMlmRemoveKeyReq,
     tLimMlmRemoveKeyCnf *mlmRemoveKeyCnf)
 {
@@ -1012,8 +1013,8 @@
   palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmRemoveKeyReq );
   pMac->lim.gpLimMlmRemoveKeyReq = NULL;
 
-  pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState; //Restore the state.
-  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+  psessionEntry->limMlmState = psessionEntry->limPrevMlmState; //Restore the state.
+  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
   limPostSmeMessage( pMac,
       LIM_MLM_REMOVEKEY_CNF,
@@ -1081,7 +1082,7 @@
   // Update the WDA_SET_BSSKEY_REQ parameters
   pSetBssKeyParams->bssIdx = psessionEntry->bssIdx;
   pSetBssKeyParams->encType = pMlmSetKeysReq->edType;
-  pSetBssKeyParams->numKeys = pMlmSetKeysReq->numKeys;
+
 
   if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
   {
@@ -1093,10 +1094,27 @@
   /* Update PE session Id*/
   pSetBssKeyParams->sessionId = psessionEntry ->peSessionId;
 
-  palCopyMemory( pMac->hHdd,
+  if(pMlmSetKeysReq->key[0].keyId && 
+     ((pMlmSetKeysReq->edType == eSIR_ED_WEP40) || 
+      (pMlmSetKeysReq->edType == eSIR_ED_WEP104))
+    )
+  {
+    /* IF the key id is non-zero and encryption type is WEP, Send all the 4 
+     * keys to HAL with filling the key at right index in pSetBssKeyParams->key. */
+    pSetBssKeyParams->numKeys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
+    palCopyMemory( pMac->hHdd,
+      (tANI_U8 *) &pSetBssKeyParams->key[pMlmSetKeysReq->key[0].keyId],
+      (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof(pMlmSetKeysReq->key[0]));
+
+  }
+  else
+  {
+    pSetBssKeyParams->numKeys = pMlmSetKeysReq->numKeys;
+    palCopyMemory( pMac->hHdd,
       (tANI_U8 *) &pSetBssKeyParams->key,
       (tANI_U8 *) &pMlmSetKeysReq->key,
       sizeof( tSirKeys ) * pMlmSetKeysReq->numKeys );
+  }
 
   SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
   msgQ.type = WDA_SET_BSSKEY_REQ;
@@ -1111,7 +1129,7 @@
 
   limLog( pMac, LOGW,
       FL( "Sending WDA_SET_BSSKEY_REQ...\n" ));
-  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
   {
     limLog( pMac, LOGE,
@@ -1208,7 +1226,7 @@
       sessionEntry->limMlmState = eLIM_MLM_WT_SET_STA_KEY_STATE;
       msgQ.type = WDA_SET_STAKEY_REQ;
   }
-  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState));
 
   /**
    * In the Case of WEP_DYNAMIC, ED_TKIP and ED_CCMP
@@ -1232,12 +1250,14 @@
 #endif
           pSetStaKeyParams->wepType = eSIR_WEP_STATIC;
           sessionEntry->limMlmState = eLIM_MLM_WT_SET_STA_KEY_STATE;
-          MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+          MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState));
       }else {
-          pSetStaKeyParams->wepType = eSIR_WEP_DYNAMIC;
+          /*This case the keys are coming from upper layer so need to fill the 
+          * key at the default wep key index and send to the HAL */
           palCopyMemory( pMac->hHdd,
-                         (tANI_U8 *) &pSetStaKeyParams->key,
-                         (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof( tSirKeys ));
+                             (tANI_U8 *) &pSetStaKeyParams->key[defWEPIdx],
+                             (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof( pMlmSetKeysReq->key[0] ));
+          pMlmSetKeysReq->numKeys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
       }
       break;
   case eSIR_ED_TKIP:
@@ -1265,7 +1285,7 @@
   msgQ.bodyval = 0;
 
   limLog( pMac, LOG1, FL( "Sending WDA_SET_STAKEY_REQ...\n" ));
-  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, sessionEntry->peSessionId, msgQ.type));
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) {
       limLog( pMac, LOGE, FL("Posting SET_STAKEY to HAL failed, reason=%X\n"), retCode );
       // Respond to SME with LIM_MLM_SETKEYS_CNF
@@ -1345,7 +1365,7 @@
 
   limLog( pMac, LOGW,
       FL( "Sending WDA_REMOVE_BSSKEY_REQ...\n" ));
-  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
   {
@@ -1361,6 +1381,7 @@
 
 end:
   limPostSmeRemoveKeyCnf( pMac,
+      psessionEntry,
       pMlmRemoveKeyReq,
       &mlmRemoveKeysCnf );
 
@@ -1390,7 +1411,7 @@
 void limSendRemoveStaKeyReq( tpAniSirGlobal pMac,
     tLimMlmRemoveKeyReq *pMlmRemoveKeyReq,
     tANI_U16 staIdx ,
-    tpPESession sessionEntry)
+    tpPESession psessionEntry)
 {
 tSirMsgQ           msgQ;
 tpRemoveStaKeyParams  pRemoveStaKeyParams = NULL;
@@ -1430,7 +1451,7 @@
   pRemoveStaKeyParams->unicast = pMlmRemoveKeyReq->unicast;
 
   /* Update PE session ID*/
-  pRemoveStaKeyParams->sessionId = sessionEntry->peSessionId;
+  pRemoveStaKeyParams->sessionId = psessionEntry->peSessionId;
 
   SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
   
@@ -1446,7 +1467,7 @@
 
   limLog( pMac, LOGW,
       FL( "Sending WDA_REMOVE_STAKEY_REQ...\n" ));
-  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
   {
     limLog( pMac, LOGE,
@@ -1461,6 +1482,7 @@
 
 end:
   limPostSmeRemoveKeyCnf( pMac,
+      psessionEntry,
       pMlmRemoveKeyReq,
       &mlmRemoveKeyCnf );
 
diff --git a/CORE/MAC/src/pe/lim/limSecurityUtils.h b/CORE/MAC/src/pe/lim/limSecurityUtils.h
index 2479f14..da1e908 100644
--- a/CORE/MAC/src/pe/lim/limSecurityUtils.h
+++ b/CORE/MAC/src/pe/lim/limSecurityUtils.h
@@ -68,7 +68,7 @@
 
 void limSendRemoveBssKeyReq(tpAniSirGlobal pMac, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq,tpPESession);
 void limSendRemoveStaKeyReq(tpAniSirGlobal pMac, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq, tANI_U16 staIdx,tpPESession);
-void limPostSmeRemoveKeyCnf(tpAniSirGlobal pMac, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq, tLimMlmRemoveKeyCnf * mlmRemoveKeyCnf);
+void limPostSmeRemoveKeyCnf(tpAniSirGlobal pMac, tpPESession psessionEntry, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq, tLimMlmRemoveKeyCnf * mlmRemoveKeyCnf);
 
 #define  PTAPS  0xedb88320
 
diff --git a/CORE/MAC/src/pe/lim/limSendManagementFrames.c b/CORE/MAC/src/pe/lim/limSendManagementFrames.c
index 131ff49..4c50af6 100644
--- a/CORE/MAC/src/pe/lim/limSendManagementFrames.c
+++ b/CORE/MAC/src/pe/lim/limSendManagementFrames.c
@@ -240,7 +240,16 @@
     {
         p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen);
     }
-    if( p2pIe != NULL)
+    /* Don't include 11b rate only when device is doing P2P Search */
+    if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) && 
+        ( p2pIe != NULL ) && 
+    /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */
+        ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) &&
+              pMac->lim.gpLimMlmScanReq->p2pSearch ) || 
+          ( ( psessionEntry != NULL ) && 
+            ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) )
+         )
+      )
     {
         /* In the below API pass channel number > 14, do that it fills only
          * 11a rates in supported rates */
@@ -272,21 +281,38 @@
        PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 );
     }
 #endif
-    pMac->lim.htCapability = IS_DOT11_MODE_HT(dot11mode);
 
     if (psessionEntry != NULL ) {
-       psessionEntry->htCapabality = IS_DOT11_MODE_HT(dot11mode);
+       psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode);
        //Include HT Capability IE
-       if (psessionEntry->htCapabality)
+       if (psessionEntry->htCapability)
        {
-           PopulateDot11fHTCaps( pMac, &pr.HTCaps );
+           PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
        }
-    } else {
-           if (pMac->lim.htCapability)
+    } else { //psessionEntry == NULL
+           if (IS_DOT11_MODE_HT(dot11mode))
            {
-               PopulateDot11fHTCaps( pMac, &pr.HTCaps );
+               PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
            }
     }
+#ifdef WLAN_FEATURE_11AC
+    if (psessionEntry != NULL ) {
+       psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode);
+       //Include HT Capability IE
+       if (psessionEntry->vhtCapability)
+       {
+          limLog( pMac, LOGW, FL("Populate VHT IEs in Probe Request\n"));
+          PopulateDot11fVHTCaps( pMac, &pr.VHTCaps );
+       }
+    }  else {
+       if (IS_DOT11_MODE_VHT(dot11mode))
+       {
+          limLog( pMac, LOGW, FL("Populate VHT IEs in Probe Request\n"));
+          PopulateDot11fVHTCaps( pMac, &pr.VHTCaps );
+       }
+    }
+#endif
+
 
     // That's it-- now we pack it.  First, how much space are we going to
     // need?
@@ -566,7 +592,7 @@
     PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry);
 
 #ifdef ANI_PRODUCT_TYPE_AP
-    if( pMac->lim.gLim11hEnable )
+    if( pSessionEntry->lim11hEnable )
     {
         PopulateDot11fPowerConstraints( pMac, &frm.PowerConstraints );
         PopulateDot11fTPCReport( pMac, &frm.TPCReport, psessionEntry);
@@ -580,8 +606,8 @@
                pMac->lim.gLimChannelSwitch.state ==
                eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY ) )
         {
-            PopulateDot11fChanSwitchAnn( pMac, &frm.ChanSwitchAnn );
-            PopulateDot11fExtChanSwitchAnn(pMac, &frm.ExtChanSwitchAnn);
+            PopulateDot11fChanSwitchAnn( pMac, &frm.ChanSwitchAnn, psessionEntry );
+            PopulateDot11fExtChanSwitchAnn(pMac, &frm.ExtChanSwitchAnn, psessionEntry );
         }
     }
 #endif
@@ -596,15 +622,25 @@
                                 &frm.ExtSuppRates, psessionEntry );
 
     //Populate HT IEs, when operating in 11n or Taurus modes.
-    if ( psessionEntry->htCapabality )
+    if ( psessionEntry->htCapability )
     {
-        PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+        PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
 #ifdef WLAN_SOFTAP_FEATURE
         PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
 #else
         PopulateDot11fHTInfo( pMac, &frm.HTInfo );
 #endif
     }
+#ifdef WLAN_FEATURE_11AC
+    if(psessionEntry->vhtCapability)
+    {
+        limLog( pMac, LOGW, FL("Populate VHT IE in Probe Response\n"));
+        PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
+        PopulateDot11fVHTOperation( pMac, &frm.VHTOperation );
+        // we do not support multi users yet
+        //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad );
+    }
+#endif
 
     if ( psessionEntry->pLimStartBssReq ) 
     {
@@ -1252,10 +1288,10 @@
         } // End if on Airgo peer.
 
         if ( pSta->mlmStaContext.htCapability  && 
-             pMac->lim.htCapability )
+             psessionEntry->htCapability )
         {
-            PopulateDot11fHTCaps( pMac, &frm.HTCaps );
-            PopulateDot11fHTInfo( pMac, &frm.HTInfo );
+            PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
+            PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry);
         }
     } // End if on non-NULL 'pSta'.
 
@@ -1524,15 +1560,26 @@
         } // End if on Airgo peer.
 
         if ( pSta->mlmStaContext.htCapability  && 
-             psessionEntry->htCapabality )
+             psessionEntry->htCapability )
         {
-            PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+            PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
 #ifdef WLAN_SOFTAP_FEATURE
             PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
 #else
             PopulateDot11fHTInfo( pMac, &frm.HTInfo );
 #endif
         }
+
+#ifdef WLAN_FEATURE_11AC
+        if( pSta->mlmStaContext.vhtCapability && 
+            psessionEntry->vhtCapability )
+        {
+            limLog( pMac, LOGW, FL("Populate VHT IEs in Assoc Response\n"));
+            PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
+            PopulateDot11fVHTOperation( pMac, &frm.VHTOperation);
+        }
+#endif
+
     } // End if on non-NULL 'pSta'.
 
 
@@ -2341,10 +2388,10 @@
 
     //Populate HT IEs, when operating in 11n or Taurus modes AND
     //when AP is also operating in 11n mode.
-    if ( psessionEntry->htCapabality &&
+    if ( psessionEntry->htCapability &&
             pMac->lim.htCapabilityPresentInBeacon)
     {
-        PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+        PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
 #ifdef DISABLE_GF_FOR_INTEROP
 
         /*
@@ -2362,6 +2409,15 @@
 #endif
 
     }
+#ifdef WLAN_FEATURE_11AC
+    if ( psessionEntry->vhtCapability &&
+        pMac->lim.vhtCapabilityPresentInBeacon)
+    {
+        limLog( pMac, LOGW, FL("Populate VHT IEs in Assoc Request\n"));
+        PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
+    }
+#endif
+
 
 #if defined WLAN_FEATURE_VOWIFI_11R
     if (psessionEntry->pLimJoinReq->is11Rconnection)
@@ -2417,7 +2473,7 @@
                     "sociation Request.\n"), nBytes );
 
         psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
 
 
         /* Update PE session id*/
@@ -2761,10 +2817,10 @@
 #endif    
     }
 
-    if ( psessionEntry->htCapabality &&
+    if ( psessionEntry->htCapability &&
             pMac->lim.htCapabilityPresentInBeacon)
     {
-        PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+        PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
     }
 
     nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
@@ -2803,7 +2859,7 @@
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
         limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
                     "sociation Request.\n"), nBytes );
         goto end;
@@ -3089,11 +3145,19 @@
         }
     }
 
-    if ( psessionEntry->htCapabality &&
+    if ( psessionEntry->htCapability &&
           pMac->lim.htCapabilityPresentInBeacon)
     {
-        PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+        PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
     }
+#ifdef WLAN_FEATURE_11AC
+    if ( psessionEntry->vhtCapability &&
+             pMac->lim.vhtCapabilityPresentInBeacon)
+    {
+        limLog( pMac, LOGW, FL("Populate VHT IEs in Re-Assoc Request\n"));
+        PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
+    }
+#endif
 
     nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
     if ( DOT11F_FAILED( nStatus ) )
@@ -3119,7 +3183,7 @@
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
         limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
                                "sociation Request.\n"), nBytes );
         goto end;
@@ -3479,6 +3543,10 @@
        || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
          ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
 #endif
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+       || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) 
+           && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)))
+#endif
          )
     {
         txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
@@ -4168,7 +4236,7 @@
 #endif  //ANI_SUPPORT_11H
 
 
-#ifdef ANI_PRODUCT_TYPE_AP
+#if 1//def ANI_PRODUCT_TYPE_AP
 /**
  * \brief Send a Channel Switch Announcement
  *
@@ -4191,17 +4259,19 @@
 tSirRetStatus
 limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
                               tSirMacAddr    peer,
-                              tANI_U8             nMode,
-                              tANI_U8             nNewChannel,
-                              tANI_U8             nCount)
+                              tANI_U8        nMode,
+                              tANI_U8        nNewChannel,
+                              tANI_U8        nCount,
+                              tpPESession    psessionEntry )
 {
     tDot11fChannelSwitch frm;
     tANI_U8                  *pFrame;
     tSirRetStatus        nSirStatus;
     tpSirMacMgmtHdr      pMacHdr;
-    tANI_U32                  nBytes, nPayload, nStatus, nCfg;
+    tANI_U32                  nBytes, nPayload, nStatus;//, nCfg;
     void               *pPacket;
     eHalStatus          halstatus;
+    tANI_U8 txFlag = 0;
     
     palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
 
@@ -4243,7 +4313,12 @@
 
     // Next, we fill out the buffer descriptor:
     nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
-                                SIR_MAC_MGMT_ACTION, peer);
+                                SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
+    pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
+    palCopyMemory( pMac->hHdd,
+                   (tANI_U8 *) pMacHdr->bssId,
+                   (tANI_U8 *) psessionEntry->bssId,
+                   sizeof( tSirMacAddr ));
     if ( eSIR_SUCCESS != nSirStatus )
     {
         limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
@@ -4253,6 +4328,7 @@
         return eSIR_FAILURE;    // just allocated...
     }
 
+#if 0
     pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
 
     nCfg = 6;
@@ -4265,7 +4341,7 @@
         palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
         return eSIR_FAILURE;    // just allocated...
     }
-
+#endif
     nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
                                        sizeof(tSirMacMgmtHdr),
                                        nPayload, &nPayload );
@@ -4282,11 +4358,20 @@
                                "hannel Switch (0x%08x).\n") );
     }
 
+    if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
+#ifdef WLAN_FEATURE_P2P
+       || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
+         ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
+#endif
+         )
+    {
+        txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
+    }
     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, 0 );
+                            limTxComplete, pFrame, txFlag );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
diff --git a/CORE/MAC/src/pe/lim/limSendMessages.c b/CORE/MAC/src/pe/lim/limSendMessages.c
index 3b95f1d..7dff6e0 100644
--- a/CORE/MAC/src/pe/lim/limSendMessages.c
+++ b/CORE/MAC/src/pe/lim/limSendMessages.c
@@ -31,14 +31,12 @@
  * --------------------------------------------------------------------------
  *
  */
-
 #include "limSendMessages.h"
 #include "cfgApi.h"
 #include "limTrace.h"
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
 #include "vos_diag_core_log.h"
 #endif //FEATURE_WLAN_DIAG_SUPPORT 
-
 /* When beacon filtering is enabled, firmware will
  * analyze the selected beacons received during BMPS,
  * and monitor any changes in the IEs as listed below.
@@ -65,7 +63,6 @@
 #endif
 };
 
-
 /**
  * limSendCFParams()
  *
@@ -87,41 +84,33 @@
  *
  * @return success if message send is ok, else false.
  */
-
 tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod)
 {
     tpUpdateCFParams pCFParams = NULL;
     tSirRetStatus   retCode = eSIR_SUCCESS;
     tSirMsgQ msgQ;
 
-
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pCFParams,
           sizeof( tUpdateCFParams )))
       {
         limLog( pMac, LOGP,
             FL( "Unable to PAL allocate memory during Update CF Params\n" ));
-
         retCode = eSIR_MEM_ALLOC_FAILED;
         goto returnFailure;
       }
-
     palZeroMemory( pMac->hHdd, (tANI_U8 *) pCFParams, sizeof(tUpdateCFParams));
-
     pCFParams->cfpCount = cfpCount;
     pCFParams->cfpPeriod = cfpPeriod;
     pCFParams->bssIdx     = bssIdx;
 
-
     msgQ.type = WDA_UPDATE_CF_IND;
     msgQ.reserved = 0;
     msgQ.bodyptr = pCFParams;
     msgQ.bodyval = 0;
-
     limLog( pMac, LOG3,
                 FL( "Sending WDA_UPDATE_CF_IND..." ));
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
-
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pCFParams);
@@ -129,13 +118,10 @@
                     FL("Posting  WDA_UPDATE_CF_IND to WDA failed, reason=%X\n"),
                     retCode );
     }
-
 returnFailure:
     return retCode;
 }
 
-
-
 /**
  * limSendBeaconParams()
  *
@@ -157,7 +143,6 @@
  *
  * @return success if message send is ok, else false.
  */
-
 tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac, 
                                   tpUpdateBeaconParams pUpdatedBcnParams,
                                   tpPESession  psessionEntry )
@@ -166,27 +151,22 @@
     tSirRetStatus   retCode = eSIR_SUCCESS;
     tSirMsgQ msgQ;
 
-
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pBcnParams, sizeof(*pBcnParams)))
     {
         limLog( pMac, LOGP,
             FL( "Unable to PAL allocate memory during Update Beacon Params\n" ));
-
         return eSIR_MEM_ALLOC_FAILED;
     }
-
     palCopyMemory( pMac->hHdd, (tANI_U8 *) pBcnParams,  pUpdatedBcnParams, sizeof(*pBcnParams));
-
     msgQ.type = WDA_UPDATE_BEACON_IND;
     msgQ.reserved = 0;
     msgQ.bodyptr = pBcnParams;
     msgQ.bodyval = 0;
-
     PELOG3(limLog( pMac, LOG3,
                 FL( "Sending WDA_UPDATE_BEACON_IND, paramChangeBitmap in hex = %x" ),
                     pUpdatedBcnParams->paramChangeBitmap);)
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pBcnParams);
@@ -197,11 +177,9 @@
 #ifdef WLAN_SOFTAP_FEATURE
     limSendBeaconInd(pMac, psessionEntry);
 #endif
-
     return retCode;
 }
 
-
 /**
  * limSendSwitchChnlParams()
  *
@@ -223,46 +201,38 @@
  *
  * @return success if message send is ok, else false.
  */
-
 #if !defined WLAN_FEATURE_VOWIFI  
 tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
                                       tANI_U8 chnlNumber,
-                                      tSirMacHTSecondaryChannelOffset secondaryChnlOffset,
+                                      ePhyChanBondState secondaryChnlOffset,
                                       tANI_U8 localPwrConstraint, tANI_U8 peSessionId)
 #else
 tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
                                       tANI_U8 chnlNumber,
-                                      tSirMacHTSecondaryChannelOffset secondaryChnlOffset,
+                                      ePhyChanBondState secondaryChnlOffset,
                                       tPowerdBm maxTxPower, tANI_U8 peSessionId)
-
 #endif
 {
     tpSwitchChannelParams pChnlParams = NULL;
     tSirRetStatus   retCode = eSIR_SUCCESS;
     tSirMsgQ msgQ;
     tpPESession pSessionEntry;
-
     if((pSessionEntry = peFindSessionBySessionId(pMac , peSessionId)) == NULL)
     {
        limLog( pMac, LOGP,
              FL( "Unable to get Session for session Id %d\n" ), peSessionId);
        return eSIR_FAILURE;
-
     }
-
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pChnlParams,
           sizeof( tSwitchChannelParams )))
       {
           limLog( pMac, LOGP,
             FL( "Unable to PAL allocate memory during Switch Channel Params\n" ));
-
         retCode = eSIR_MEM_ALLOC_FAILED;
         goto returnFailure;
       }
-
     palZeroMemory( pMac->hHdd, (tANI_U8 *) pChnlParams, sizeof(tSwitchChannelParams));
-
     pChnlParams->secondaryChannelOffset = secondaryChnlOffset;
     pChnlParams->channelNumber= chnlNumber;
 #if defined WLAN_FEATURE_VOWIFI  
@@ -271,19 +241,16 @@
 #else
     pChnlParams->localPowerConstraint = localPwrConstraint;
 #endif
-
     palCopyMemory( pMac->hHdd, pChnlParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
     pChnlParams->peSessionId = peSessionId;
     
     //we need to defer the message until we get the response back from WDA.
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-
     msgQ.type = WDA_CHNL_SWITCH_REQ;
     msgQ.reserved = 0;
     msgQ.bodyptr = pChnlParams;
     msgQ.bodyval = 0;
-
-#if !defined WLAN_FEATURE_VOWIFI  
+#if defined WLAN_FEATURE_VOWIFI  
     PELOG3(limLog( pMac, LOG3,
         FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, maxTxPower - %d"),
         pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->maxTxPower);)
@@ -292,7 +259,7 @@
         FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, LocalPowerConstraint - %d"),
         pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->localPowerConstraint);)
 #endif
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, peSessionId, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pChnlParams);
@@ -300,12 +267,10 @@
                     FL("Posting  WDA_CHNL_SWITCH_REQ to WDA failed, reason=%X\n"),
                     retCode );
     }
-
 returnFailure:
     return retCode;
 }
 
-
 /**
  * limSendEdcaParams()
  *
@@ -327,36 +292,30 @@
  *
  * @return success if message send is ok, else false.
  */
-
 tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance)
 {
     tEdcaParams *pEdcaParams = NULL;
     tSirRetStatus   retCode = eSIR_SUCCESS;
     tSirMsgQ msgQ;
-
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pEdcaParams,
           sizeof(tEdcaParams)))
     {
         limLog( pMac, LOGP,
             FL( "Unable to PAL allocate memory during Update EDCA Params\n" ));
-
         retCode = eSIR_MEM_ALLOC_FAILED;
         return retCode;
     }
-
     pEdcaParams->bssIdx = bssIdx;
     pEdcaParams->acbe = pUpdatedEdcaParams[EDCA_AC_BE];
     pEdcaParams->acbk = pUpdatedEdcaParams[EDCA_AC_BK];
     pEdcaParams->acvi = pUpdatedEdcaParams[EDCA_AC_VI];
     pEdcaParams->acvo = pUpdatedEdcaParams[EDCA_AC_VO];
     pEdcaParams->highPerformance = highPerformance;
-
     msgQ.type = WDA_UPDATE_EDCA_PROFILE_IND;
     msgQ.reserved = 0;
     msgQ.bodyptr = pEdcaParams;
     msgQ.bodyval = 0;
-
     {
         tANI_U8 i;
         PELOG1(limLog( pMac, LOG1,FL("Sending WDA_UPDATE_EDCA_PROFILE_IND with EDCA Parameters:" ));)
@@ -367,7 +326,7 @@
                    pUpdatedEdcaParams[i].cw.min, pUpdatedEdcaParams[i].cw.max, pUpdatedEdcaParams[i].txoplimit);)
         }
     }
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pEdcaParams);
@@ -375,11 +334,9 @@
                     FL("Posting  WDA_UPDATE_EDCA_PROFILE_IND to WDA failed, reason=%X\n"),
                     retCode );
     }
-
     return retCode;
 }
 
-
 /**
  * limSetActiveEdcaParams()
  *
@@ -404,13 +361,11 @@
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
     vos_log_qos_edca_pkt_type *log_ptr = NULL;
 #endif //FEATURE_WLAN_DIAG_SUPPORT 
-
     // Initialize gLimEdcaParamsActive[] to be same as localEdcaParams
     psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE] = plocalEdcaParams[EDCA_AC_BE];
     psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK] = plocalEdcaParams[EDCA_AC_BK];
     psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI] = plocalEdcaParams[EDCA_AC_VI];
     psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO] = plocalEdcaParams[EDCA_AC_VO];
-
     /* An AC requires downgrade if the ACM bit is set, and the AC has not
      * yet been admitted in uplink or bi-directions.
      * If an AC requires downgrade, it will downgrade to the next beset AC
@@ -430,7 +385,6 @@
     {
         acAdmitted = ( (pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] & (1 << ac)) >> ac );
         limLog(pMac, LOG1, FL("For AC[%d]: acm=%d,  acAdmit=%d \n"), ac, plocalEdcaParams[ac].aci.acm, acAdmitted);
-
         if ( (plocalEdcaParams[ac].aci.acm == 1) && (acAdmitted == 0) )
         {
             limLog(pMac, LOG1, FL("We need to downgrade AC %d!! "), ac);
@@ -475,7 +429,6 @@
     return;
  }
 
-
 /** ---------------------------------------------------------
 \fn      limSetLinkState
 \brief   LIM sends a message to WDA to set the link state
@@ -489,20 +442,16 @@
 {
     tSirMsgQ msg;
     tSirRetStatus retCode;
-
     msg.type = WDA_SET_LINK_STATE;
     msg.bodyval = (tANI_U32) state;
     msg.bodyptr = NULL;
-
     MTRACE(macTraceMsgTx(pMac, 0, msg.type));
     retCode = wdaPostCtrlMsg(pMac, &msg);
     if (retCode != eSIR_SUCCESS)
         limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
-
     return retCode;
 }
 #endif //0
-
 tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId, 
                               tSirMacAddr selfMacAddr, tpSetLinkStateCallback callback, 
                               void *callbackArg) 
@@ -510,7 +459,6 @@
     tSirMsgQ msgQ;
     tSirRetStatus retCode;
     tpLinkStateParams pLinkStateParams = NULL;
-
     // Allocate memory.
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pLinkStateParams,
@@ -518,29 +466,24 @@
     {
         limLog( pMac, LOGP,
         FL( "Unable to PAL allocate memory while sending Set Link State\n" ));
-
         retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
         return retCode;
     }
-
     palZeroMemory( pMac->hHdd, (tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams));
-
     pLinkStateParams->state        = state;
     pLinkStateParams->callback     = callback;
     pLinkStateParams->callbackArg  = callbackArg;
      
-
     /* Copy Mac address */
     sirCopyMacAddr(pLinkStateParams->bssid,bssId);
     sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
 
-
     msgQ.type = WDA_SET_LINK_STATE;
     msgQ.reserved = 0;
     msgQ.bodyptr = pLinkStateParams;
     msgQ.bodyval = 0;
     
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
 
     retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
     if (retCode != eSIR_SUCCESS)
@@ -548,10 +491,8 @@
         palFreeMemory(pMac, (void*)pLinkStateParams);
         limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
     }
-
     return retCode;
 }
-
 #ifdef WLAN_FEATURE_VOWIFI_11R
 extern tSirRetStatus limSetLinkStateFT(tpAniSirGlobal pMac, tSirLinkState 
 state,tSirMacAddr bssId, tSirMacAddr selfMacAddr, int ft, tpPESession psessionEntry)
@@ -559,7 +500,6 @@
     tSirMsgQ msgQ;
     tSirRetStatus retCode;
     tpLinkStateParams pLinkStateParams = NULL;
-
     // Allocate memory.
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pLinkStateParams,
@@ -567,28 +507,23 @@
     {
         limLog( pMac, LOGP,
         FL( "Unable to PAL allocate memory while sending Set Link State\n" ));
-
         retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
         return retCode;
     }
-
     palZeroMemory( pMac->hHdd, (tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams));
-
     pLinkStateParams->state = state;
-
     /* Copy Mac address */
     sirCopyMacAddr(pLinkStateParams->bssid,bssId);
     sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
     pLinkStateParams->ft = 1;
     pLinkStateParams->session = psessionEntry;
 
-
     msgQ.type = WDA_SET_LINK_STATE;
     msgQ.reserved = 0;
     msgQ.bodyptr = pLinkStateParams;
     msgQ.bodyval = 0;
     
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 
     retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
     if (retCode != eSIR_SUCCESS)
@@ -596,13 +531,10 @@
         palFreeMemory(pMac, (void*)pLinkStateParams);
         limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
     }
-
     return retCode;
 }
 #endif
 
-
-
 /** ---------------------------------------------------------
 \fn      limSendSetTxPowerReq
 \brief   LIM sends a WDA_SET_TX_POWER_REQ message to WDA 
@@ -614,18 +546,14 @@
 {
     tSirRetStatus  retCode = eSIR_SUCCESS;
     tSirMsgQ       msgQ;
-
     if (NULL == pTxPowerReq)
         return retCode;
-
     msgQ.type = WDA_SET_TX_POWER_REQ;
     msgQ.reserved = 0;
     msgQ.bodyptr = pTxPowerReq;
     msgQ.bodyval = 0;
-
     PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_SET_TX_POWER_REQ to WDA"));)
-
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         limLog( pMac, LOGP, FL("Posting WDA_SET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
@@ -637,7 +565,6 @@
     }
     return retCode;
 }
-
 /** ---------------------------------------------------------
 \fn      limSendGetTxPowerReq
 \brief   LIM sends a WDA_GET_TX_POWER_REQ message to WDA
@@ -649,18 +576,14 @@
 {
     tSirRetStatus  retCode = eSIR_SUCCESS;
     tSirMsgQ       msgQ;
-
     if (NULL == pTxPowerReq)
         return retCode;
-
     msgQ.type = WDA_GET_TX_POWER_REQ;
     msgQ.reserved = 0;
     msgQ.bodyptr = pTxPowerReq;
     msgQ.bodyval = 0;
-
     PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_GET_TX_POWER_REQ to WDA"));)
-
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         limLog( pMac, LOGP, FL("Posting WDA_GET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
@@ -672,7 +595,6 @@
     }
     return retCode;
 }
-
 /** ---------------------------------------------------------
 \fn      limSendBeaconFilterInfo
 \brief   LIM sends beacon filtering info to WDA
@@ -690,7 +612,6 @@
     tpBeaconFilterIe   pIe;
     tpPESession psessionEntry = &pMac->lim.gpSession[0];  //TBD-RAJESH get the sessionEntry from the caller
 
-
     msgSize = sizeof(tBeaconFilterMsg) + sizeof(beaconFilterTable);
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pBeaconFilterMsg, msgSize) )
@@ -700,18 +621,14 @@
         return retCode;
     }
     palZeroMemory( pMac->hHdd, (tANI_U8 *) pBeaconFilterMsg, msgSize);
-
     // Fill in capability Info and mask
     //TBD-RAJESH get the BSS capability from session.
     //Don't send this message if no active Infra session is found.
     pBeaconFilterMsg->capabilityInfo = psessionEntry->limCurrentBssCaps;
     pBeaconFilterMsg->capabilityMask = CAPABILITY_FILTER_MASK;
-
     pBeaconFilterMsg->beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
-
     // Fill in number of IEs in beaconFilterTable
     pBeaconFilterMsg->ieNum = (tANI_U16) (sizeof(beaconFilterTable) / sizeof(tBeaconFilterIe));
-
     //Fill message with info contained in the beaconFilterTable
     ptr = (tANI_U8 *)pBeaconFilterMsg + sizeof(tBeaconFilterMsg);
     for(i=0; i < (pBeaconFilterMsg->ieNum); i++)
@@ -725,14 +642,12 @@
         pIe->byte.ref =  beaconFilterTable[i].byte.ref; 
         ptr += sizeof(tBeaconFilterIe);
     }
-
     msgQ.type = WDA_BEACON_FILTER_IND;
     msgQ.reserved = 0;
     msgQ.bodyptr = pBeaconFilterMsg;
     msgQ.bodyval = 0;
-
     limLog( pMac, LOG3, FL( "Sending WDA_BEACON_FILTER_IND..." ));
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pBeaconFilterMsg);
@@ -741,7 +656,5 @@
             retCode );
         return retCode;
     }
-
     return retCode;
 }
-
diff --git a/CORE/MAC/src/pe/lim/limSendMessages.h b/CORE/MAC/src/pe/lim/limSendMessages.h
index 3871659..71b07ed 100644
--- a/CORE/MAC/src/pe/lim/limSendMessages.h
+++ b/CORE/MAC/src/pe/lim/limSendMessages.h
@@ -34,26 +34,22 @@
 #ifndef __LIM_SEND_MESSAGES_H
 #define __LIM_SEND_MESSAGES_H
 
-
-
 #include "aniGlobal.h"
 #include "limTypes.h"
 #include "halMsgApi.h"
 #include "sirParams.h"    
-
 tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod);
 tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac, 
                                   tpUpdateBeaconParams pUpdatedBcnParams,
                                   tpPESession  psessionEntry );
-
 //tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac, tpUpdateBeaconParams pUpdatedBcnParams);
 #if defined WLAN_FEATURE_VOWIFI  
 tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac, tANI_U8 chnlNumber, 
-                                      tSirMacHTSecondaryChannelOffset secondaryChnlOffset, 
+                                      ePhyChanBondState secondaryChnlOffset, 
                                       tPowerdBm maxTxPower,tANI_U8 peSessionId);
 #else
 tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac, tANI_U8 chnlNumber, 
-                                      tSirMacHTSecondaryChannelOffset secondaryChnlOffset, 
+                                      ePhyChanBondState secondaryChnlOffset, 
                                       tANI_U8 localPwrConstraint,tANI_U8 peSessionId);
 #endif
 tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance);
@@ -66,9 +62,7 @@
 #endif
 tSirRetStatus limSendSetTxPowerReq(tpAniSirGlobal pMac, tpSirSetTxPowerReq pTxPowerReq);
 tSirRetStatus limSendGetTxPowerReq(tpAniSirGlobal pMac, tpSirGetTxPowerReq pTxPowerReq);
-
 void limSetActiveEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *plocalEdcaParams, tpPESession psessionEntry);
-
 #define CAPABILITY_FILTER_MASK  0x73CF
 #define ERP_FILTER_MASK         0xF8
 #define EDCA_FILTER_MASK        0xF0
@@ -78,8 +72,6 @@
 #define HT_BYTE5_FILTER_MASK    0xFD
 #define DS_PARAM_CHANNEL_MASK   0x0
 
-
 tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac);
 
-
 #endif
diff --git a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
index 1d1ccd0..1ceed6b 100644
--- a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
+++ b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
@@ -123,7 +123,7 @@
     mmhMsg.type = msgType;
     mmhMsg.bodyptr = pSirSmeRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
    {
@@ -201,7 +201,7 @@
     mmhMsg.type = pSirSmeJoinRsp->messageType;
     mmhMsg.bodyptr = pSirSmeJoinRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 }
 
@@ -377,7 +377,7 @@
                 palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames + psessionEntry->bcnLen + psessionEntry->assocReqLen + psessionEntry->assocRspLen, psessionEntry->ricData, pSirSmeJoinRsp->parsedRicRspLen);
                 palFreeMemory(pMac->hHdd, psessionEntry->ricData);
                 psessionEntry->ricData = NULL;
-                PELOG1(limLog(pMac, LOG1, FL("RicLength=%d\n"), psessionEntry->parsedRicRspLen);)
+                PELOG1(limLog(pMac, LOG1, FL("RicLength=%d\n"), pSirSmeJoinRsp->parsedRicRspLen);)
             }
 #endif
 #ifdef FEATURE_WLAN_CCX            
@@ -409,9 +409,23 @@
     
     if(IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
     {
+        ePhyChanBondState htSecondaryChannelOffset;
         if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
         {
-            peSetResumeChannel( pMac, psessionEntry->currentOperChannel, 0);
+            
+#ifdef WLAN_FEATURE_11AC
+            if (psessionEntry->vhtCapability)
+            {
+               /*Get 11ac cbState from 11n cbState*/
+                 htSecondaryChannelOffset = limGet11ACPhyCBState(pMac, 
+                                    psessionEntry->currentOperChannel,
+                                    psessionEntry->htSecondaryChannelOffset);
+                peSetResumeChannel( pMac, psessionEntry->currentOperChannel, htSecondaryChannelOffset);
+            }
+            else {
+#endif
+            peSetResumeChannel( pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset);
+        }
         }
         else
         {
@@ -571,7 +585,7 @@
     mmhMsg.type = msgType;
     mmhMsg.bodyptr = pSirSmeRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, 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);
@@ -685,7 +699,7 @@
 #endif
                 mmhMsg.bodyptr = pSirSmeScanRsp;
                 mmhMsg.bodyval = 0;
-                MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+                MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
                 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
                 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, allocLength))
                 {
@@ -755,7 +769,7 @@
         mmhMsg.type = eWNI_SME_SCAN_RSP;
         mmhMsg.bodyptr = pSirSmeScanRsp;
         mmhMsg.bodyval = 0;
-        MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
         limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
         PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
     }
@@ -824,7 +838,7 @@
     mmhMsg.bodyptr = pSirSmeScanRsp;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, 0, 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
@@ -834,6 +848,77 @@
 
 }  /*** limPostSmeScanRspMessage ***/
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+
+/**
+ * limSendSmeOemDataRsp()
+ *
+ *FUNCTION:
+ * This function is called by limProcessSmeReqMessages() to send
+ * eWNI_SME_OEM_DATA_RSP message to applications above MAC
+ * Software.
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param pMac         Pointer to Global MAC structure
+ * @param pMsgBuf      Indicates the mlm message
+ * @param resultCode   Indicates the result of previously issued
+ *                     eWNI_SME_OEM_DATA_RSP message
+ *
+ * @return None
+ */
+
+void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCodes resultCode)
+{
+    tSirMsgQ                      mmhMsg;
+    tSirOemDataRsp*               pSirSmeOemDataRsp=NULL;
+    tLimMlmOemDataRsp*            pMlmOemDataRsp=NULL;
+    tANI_U16                      msgLength;
+
+    
+    //get the pointer to the mlm message
+    pMlmOemDataRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
+
+    msgLength = sizeof(tSirOemDataRsp);
+
+    //now allocate memory for the char buffer
+    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)&pSirSmeOemDataRsp, msgLength))
+    {
+        limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSirSmeOemDataRsp\n"));
+        return;
+    }
+
+#if defined (ANI_LITTLE_BYTE_ENDIAN)
+    sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->length, msgLength);
+    sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->messageType, eWNI_SME_OEM_DATA_RSP);
+#else
+    pSirSmeOemDataRsp->length = msgLength;
+    pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
+#endif
+
+    palCopyMemory(pMac->hHdd, pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE);
+
+    //Now free the memory from MLM Rsp Message
+    palFreeMemory(pMac->hHdd, pMlmOemDataRsp);
+
+    mmhMsg.type = eWNI_SME_OEM_DATA_RSP;
+    mmhMsg.bodyptr = pSirSmeOemDataRsp;
+    mmhMsg.bodyval = 0;
+
+    limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
+
+    return;
+}  /*** limSendSmeOemDataRsp ***/
+
+#endif
 
 
 /**
@@ -925,7 +1010,7 @@
     mmhMsg.bodyptr = pMsg;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
 
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 }
@@ -1110,7 +1195,10 @@
     if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
     {
         //Resume on the first active session channel.
-        peSetResumeChannel( pMac, peGetActiveSessionChannel( pMac ), 0);
+        tANI_U8 resumeChannel;
+        ePhyChanBondState resumePhyCbState;
+        peGetActiveSessionChannel( pMac, &resumeChannel, &resumePhyCbState );
+        peSetResumeChannel( pMac, resumeChannel, resumePhyCbState );
 
         limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume, 
                                               (tANI_U32*) pMsg );
@@ -1195,7 +1283,7 @@
     mmhMsg.bodyptr = pSirSmeDisassocInd;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, 0, 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
@@ -1291,7 +1379,7 @@
     mmhMsg.bodyptr = pSirSmeDeauthInd;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1453,7 +1541,10 @@
     if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
     {
         //Resume on the first active session channel.
-        peSetResumeChannel( pMac, peGetActiveSessionChannel( pMac ), 0);
+        tANI_U8 resumeChannel;
+        ePhyChanBondState resumePhyCbState;
+        peGetActiveSessionChannel( pMac, &resumeChannel, &resumePhyCbState );
+        peSetResumeChannel( pMac, resumeChannel, resumePhyCbState );
 
         limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume, 
                                               (tANI_U32*) pMsg );
@@ -1608,7 +1699,7 @@
     }
 
 
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
     {
         palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
@@ -1692,7 +1783,7 @@
     mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
     mmhMsg.bodyptr = pSirSmeSetContextRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
@@ -1775,7 +1866,7 @@
     mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
     mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 } /*** end limSendSmeSetContextRsp() ***/
 
@@ -1916,7 +2007,7 @@
     msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
     msgQ.bodyptr = pNewBssInd;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
 } /*** end limSendSmeNeighborBssInd() ***/
 
@@ -1960,7 +2051,7 @@
     mmhMsg.type = eWNI_SME_ADDTS_RSP;
     mmhMsg.bodyptr = rsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, 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);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1995,7 +2086,7 @@
     mmhMsg.type = eWNI_SME_ADDTS_IND;
     mmhMsg.bodyptr = rsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 }
 
@@ -2040,7 +2131,7 @@
     mmhMsg.type = eWNI_SME_DELTS_RSP;
     mmhMsg.bodyptr = rsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, 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);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -2080,7 +2171,7 @@
     mmhMsg.type = eWNI_SME_DELTS_IND;
     mmhMsg.bodyptr = rsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, 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_IND_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -2143,7 +2234,7 @@
 
     mmhMsg.bodyptr = stats;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);                                                  
 
     return;
@@ -2202,7 +2293,7 @@
 
     mmhMsg.bodyptr = stats;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);                                                  
 
     return;
@@ -2251,7 +2342,7 @@
     mmhMsg.type    = msgType;
 //    mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
     mmhMsg.bodyptr = pNewPeerInd;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
     
 }
@@ -2297,7 +2388,7 @@
     mmhMsg.bodyval = 0;
   
     PELOG1(limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. \n"));)        
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    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
@@ -2363,7 +2454,7 @@
     mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
     mmhMsg.bodyptr = aggrQosRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2388,7 +2479,7 @@
     mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
     mmhMsg.bodyptr = NULL;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2412,7 +2503,7 @@
     mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
     mmhMsg.bodyptr = NULL;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2441,7 +2532,7 @@
     PELOG1(limLog(pMac, LOG1, FL("msgType %s peerMacAddr %02x-%02x-%02x-%02x-%02x-%02x"
                 "sme session id %d\n"),"eWNI_SME_MAX_ASSOC_EXCEEDED", peerMacAddr[0], peerMacAddr[1],
                 peerMacAddr[2], peerMacAddr[3], peerMacAddr[4], peerMacAddr[5], smesessionId);)
-    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
diff --git a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h
index d5e8050..8554d9b 100644
--- a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h
+++ b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h
@@ -89,6 +89,9 @@
                tANI_U8 *beacon,tANI_U16 beaconLen, tANI_U16 msgType, tANI_U8 sessionId);
 void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode);
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCodes resultCode);
+#endif
 
 void limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac);
 void limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac);
diff --git a/CORE/MAC/src/pe/lim/limSerDesUtils.c b/CORE/MAC/src/pe/lim/limSerDesUtils.c
index 456f9d6..f9df7ec 100644
--- a/CORE/MAC/src/pe/lim/limSerDesUtils.c
+++ b/CORE/MAC/src/pe/lim/limSerDesUtils.c
@@ -187,14 +187,6 @@
     if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
         return eSIR_FAILURE;
 
-    // Extract the TITAN capability info
-    // NOTE - titanHtCaps is now DWORD aligned
-    pBssDescription->titanHtCaps = limGetU32( pBuf );
-    pBuf += sizeof(tANI_U32);
-    len  -= sizeof(tANI_U32);
-    if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
-        return eSIR_FAILURE;
-
     //pass the timestamp
     pBssDescription->nReceivedTime = limGetU32( pBuf );
     pBuf += sizeof(tANI_TIMESTAMP);
@@ -593,17 +585,13 @@
     pBuf       += sizeof(tSirMacAddr);
     bssInfoLen += sizeof(tSirMacAddr);
    PELOG3(limLog(pMac, LOG3,
-       FL("Copying new NeighborWds node:channel is %d, TITAN HT Caps are %1d, wniIndicator is %d, bssType is %d, bssId is "),
-       pBssInfo->channelId, pBssInfo->titanHtCaps, pBssInfo->wniIndicator,
-       pBssInfo->bssType);
+       FL("Copying new NeighborWds node:channel is %d, wniIndicator is %d, bssType is %d, bssId is "),
+       pBssInfo->channelId, pBssInfo->wniIndicator, pBssInfo->bssType);
     limPrintMacAddr(pMac, pBssInfo->bssId, LOG3);)
 
     *pBuf++ = pBssInfo->channelId;
     bssInfoLen++;
 
-    *pBuf++ = pBssInfo->titanHtCaps;
-    bssInfoLen++;
-
     limCopyU32(pBuf, pBssInfo->wniIndicator);
     pBuf       += sizeof(tANI_U32);
     bssInfoLen += sizeof(tANI_U32);
@@ -1366,7 +1354,7 @@
     len--;
 
     // Extract CB secondary channel info
-    pStartBssReq->cbMode = (tAniCBSecondaryMode)limGetU32( pBuf );
+    pStartBssReq->cbMode = (ePhyChanBondState)limGetU32( pBuf );
     pBuf += sizeof( tANI_U32 );
     len -= sizeof( tANI_U32 );
 
@@ -1789,6 +1777,12 @@
     if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
         return eSIR_FAILURE;
 
+    // Extract cbMode
+    pJoinReq->cbMode = *pBuf++;
+    len--;
+    if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+        return eSIR_FAILURE;
+
     // Extract uapsdPerAcBitmask
     pJoinReq->uapsdPerAcBitmask = *pBuf++;
     len--;
@@ -2193,11 +2187,6 @@
 
 #endif
 
-    // Copy the new TITAN capabilities
-    *pBuf = pAssocInd->titanHtCaps;
-    pBuf++;
-    mLen++;
-
     limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
     pBuf += sizeof(tAniBool);
     mLen += sizeof(tAniBool);
@@ -2766,11 +2755,6 @@
     mLen += sizeof(tANI_U32);
 #endif
 
-    // Copy the new TITAN capabilities
-    *pBuf = pReassocInd->titanHtCaps;
-    pBuf++;
-    mLen++;
-
     limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
     pBuf += sizeof(tAniBool);
     mLen += sizeof(tAniBool);
@@ -3425,7 +3409,7 @@
         pMac->lim.htCapabilityPresentInBeacon = 1;
     else
         pMac->lim.htCapabilityPresentInBeacon = 0;
-    if (neighborBssInfo.localPowerConstraints && pMac->lim.gLim11hEnable)
+    if (neighborBssInfo.localPowerConstraints && pSessionEntry->lim11hEnable)
     {
         localPowerConstraints = neighborBssInfo.localPowerConstraints;
     }
diff --git a/CORE/MAC/src/pe/lim/limSession.c b/CORE/MAC/src/pe/lim/limSession.c
index 3d3a553..6348bf8 100644
--- a/CORE/MAC/src/pe/lim/limSession.c
+++ b/CORE/MAC/src/pe/lim/limSession.c
@@ -152,7 +152,11 @@
 #endif
             *sessionId = i;
 
-            pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode 
+            pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode
+            /* Initialize CB mode variables when session is created */
+            pMac->lim.gpSession[i].htSupportedChannelWidthSet = 0;
+            pMac->lim.gpSession[i].htRecommendedTxWidthSet = 0;
+            pMac->lim.gpSession[i].htSecondaryChannelOffset = 0;
             return(&pMac->lim.gpSession[i]);
         }
     }
@@ -262,7 +266,7 @@
        }
     }
 
-    limLog(pMac, LOG4, FL("Session lookup fails for StaId: \n "));
+    limLog(pMac, LOG4, FL("Session lookup fails for StaId: %d\n "), staid);
     return(NULL);
 }
 
@@ -280,9 +284,24 @@
 void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
 {
     tANI_U16 i = 0;
+    tANI_U16 n;
+    TX_TIMER *timer_ptr;
 
     limLog(pMac, LOGW, FL("Trying to delete a session %d.\n "), psessionEntry->peSessionId);
 
+    for (n = 0; n < pMac->lim.maxStation; n++)
+    {
+        timer_ptr = &pMac->lim.limTimers.gpLimCnfWaitTimer[n];
+
+        if(psessionEntry->peSessionId == timer_ptr->sessionId)
+        {
+            if(VOS_TRUE == tx_timer_running(timer_ptr))
+            {
+                tx_timer_deactivate(timer_ptr);
+            }
+        }
+    }
+    
     if(psessionEntry->pLimStartBssReq != NULL)
     {
         palFreeMemory( pMac->hHdd, psessionEntry->pLimStartBssReq );
@@ -404,7 +423,9 @@
          }
       }
    }   
-   
+
+   limLog(pMac, LOG1, FL("Session lookup fails for Peer StaId: \n "));
+   limPrintMacAddr(pMac, sa, LOG1);
    return NULL;
 }
 
diff --git a/CORE/MAC/src/pe/lim/limSessionUtils.c b/CORE/MAC/src/pe/lim/limSessionUtils.c
index a07d0c9..bc53e77 100644
--- a/CORE/MAC/src/pe/lim/limSessionUtils.c
+++ b/CORE/MAC/src/pe/lim/limSessionUtils.c
@@ -20,11 +20,9 @@
  */
 
 /**=========================================================================
-  
-  \file  limSessionUtils.c
-  
-  \brief implementation for lim Session Utility  APIs
 
+  \file  limSessionUtils.c
+  \brief implementation for lim Session Utility  APIs
   \author Sunit Bhatia
   
   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
@@ -40,8 +38,63 @@
 #include "limSessionUtils.h"
 #include "limUtils.h"
 
+/*--------------------------------------------------------------------------
+  \brief peGetVhtCapable() - Returns the Vht capable from a valid session.
+
+  This function itrates the session Table and returns the VHT capable from first valid session
+   if no sessions are valid/present  it returns FALSE
+    
+  \param pMac                   - pointer to global adapter context
+  \return                           - channel to scan from valid session else zero.
+  
+  \sa
+  
+  --------------------------------------------------------------------------*/
+tANI_U8 peGetVhtCapable(tpAniSirGlobal pMac)
+
+{
+#ifdef WLAN_FEATURE_11AC
+    tANI_U8 i;
+    //assumption here is that all the sessions will be on the same channel.
+    //This function will not work, once we have multiple channel support.
+    for(i =0; i < pMac->lim.maxBssId; i++)
+    {
+        if(pMac->lim.gpSession[i].valid)
+        {
+            return(pMac->lim.gpSession[i].vhtCapability);  
+        }
+    }
+#endif
+    return FALSE;
+}
+/*--------------------------------------------------------------------------
+  \brief peGetCurrentChannel() - Returns the  channel number for scanning, 
+                                from a valid session.
+   This function itrates the session Table and returns the channel number 
+   from first valid session if no sessions are valid/present  it returns zero
+
+  \param pMac                   - pointer to global adapter context
+  \return                       - channel to scan from valid session else zero.
+  \sa
+  --------------------------------------------------------------------------*/
+tANI_U8 peGetCurrentChannel(tpAniSirGlobal pMac)
+{
+    tANI_U8 i;
+    //assumption here is that all the sessions will be on the same channel.
+    //This function will not work, once we have multiple channel support.
+    for(i =0; i < pMac->lim.maxBssId; i++)
+    {
+        if(pMac->lim.gpSession[i].valid)
+        {
+            return(pMac->lim.gpSession[i].currentOperChannel);
+        }
+    }
+    return(HAL_INVALID_CHANNEL_ID);
+}
+
 
 /*--------------------------------------------------------------------------
+
   \brief peValidateJoinReq() - validates the Join request .
 
   This function is called to validate the Join Request for a BT-AMP station. If start BSS session is present
@@ -179,7 +232,7 @@
           //Skip the sessionId that is to be joined.
           continue;
         }
-        //if snother ession is valid and it is on different channel
+        //if another ession is valid and it is on different channel
         //it is an off channel operation.
         if( (pMac->lim.gpSession[i].valid) && 
             (pMac->lim.gpSession[i].currentOperChannel != 
@@ -193,22 +246,156 @@
 
 }
 
+/*--------------------------------------------------------------------------
+  \brief peGetActiveSessionChannel() - Gets the operating channel of first  
+                                    valid session. Returns 0 if there is no
+									valid session.
+
+  \param pMac                   - pointer to global adapter context
+  
+  \return tANI_U8               - operating channel.
+  
+  \sa
+  --------------------------------------------------------------------------*/
+void
+peGetActiveSessionChannel (tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
+{
+    tANI_U8 i;
+
+    // Initialize the pointers passed to INVALID values in case we don't find a valid session
+    *resumeChannel = 0;
+    *resumePhyCbState = 0;
+    for(i =0; i < pMac->lim.maxBssId; i++)
+    {
+        if(pMac->lim.gpSession[i].valid)
+        {
+            *resumeChannel = pMac->lim.gpSession[i].currentOperChannel;
+            *resumePhyCbState = pMac->lim.gpSession[i].htSecondaryChannelOffset;
+            
+#ifdef WLAN_FEATURE_11AC
+            if ((pMac->lim.gpSession[i].vhtCapability))
+            {
+               /*Get 11ac cbState from 11n cbState*/
+                *resumePhyCbState = limGet11ACPhyCBState(pMac, 
+                                    pMac->lim.gpSession[i].currentOperChannel,
+                                    pMac->lim.gpSession[i].htSecondaryChannelOffset);
+            }
+#endif
+        }
+    }
+    return;
+}
+
+/*--------------------------------------------------------------------------
+  \brief limIsChanSwitchRunning() - Check if channel switch is running on any  
+                                    valid session.
+
+  \param pMac                   - pointer to global adapter context
+  
+  \return tANI_U8               - 1 - if chann switching running.
+                                  0 - if chann switching is not running. 
+  
+  \sa
+  --------------------------------------------------------------------------*/
 tANI_U8
-peGetActiveSessionChannel (tpAniSirGlobal pMac)
+limIsChanSwitchRunning (tpAniSirGlobal pMac)
 {
     tANI_U8 i;
 
     for(i =0; i < pMac->lim.maxBssId; i++)
     {
-        //if snother ession is valid and it is on different channel
-        //it is an off channel operation.
-        if(pMac->lim.gpSession[i].valid)
+        if(pMac->lim.gpSession[i].valid && 
+            pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
         {
-            return pMac->lim.gpSession[i].currentOperChannel;
+            return 1;
         }
     }
-
     return 0;
+}
+/*--------------------------------------------------------------------------
+  \brief limIsInQuietDuration() - Check if channel quieting is running on any  
+                                    valid session.
 
+  \param pMac                   - pointer to global adapter context
+  
+  \return tANI_U8               - 1 - if chann quiet running.
+                                  0 - if chann quiet is not running. 
+  
+  \sa
+  --------------------------------------------------------------------------*/
+tANI_U8
+limIsInQuietDuration (tpAniSirGlobal pMac)
+{
+    tANI_U8 i;
+
+    for(i =0; i < pMac->lim.maxBssId; i++)
+    {
+        if(pMac->lim.gpSession[i].valid && 
+            pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
+        {
+            return 1;
+        }
+    }
+    return 0;
+}
+/*--------------------------------------------------------------------------
+  \brief limIsQuietBegin() - Check if channel quieting is begining on any  
+                                    valid session.
+
+  \param pMac                   - pointer to global adapter context
+  
+  \return tANI_U8               - 1 - if chann quiet running.
+                                  0 - if chann quiet is not running. 
+  
+  \sa
+  --------------------------------------------------------------------------*/
+tANI_U8
+limIsQuietBegin (tpAniSirGlobal pMac)
+{
+    tANI_U8 i;
+
+    for(i =0; i < pMac->lim.maxBssId; i++)
+    {
+        if(pMac->lim.gpSession[i].valid && 
+            pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
+        {
+            return 1;
+        }
+    }
+    return 0;
 }
 
+/*--------------------------------------------------------------------------
+  \brief limIsInMCC() - Check if Device is in MCC.
+
+  \param pMac                   - pointer to global adapter context
+  
+  \return tANI_U8               - TRUE - if in MCC.
+                                  FALSE - NOT in MCC. 
+  
+  \sa
+  --------------------------------------------------------------------------*/
+tANI_U8
+limIsInMCC (tpAniSirGlobal pMac)
+{
+    tANI_U8 i;
+    tANI_U8 chan = 0;
+
+    for(i = 0; i < pMac->lim.maxBssId; i++)
+    {
+        //if another session is valid and it is on different channel
+        //it is an off channel operation.
+        if( (pMac->lim.gpSession[i].valid) )
+        { 
+            if( chan == 0 )
+            {
+                chan = pMac->lim.gpSession[i].currentOperChannel;
+            } 
+            else if( chan != pMac->lim.gpSession[i].currentOperChannel)
+            {
+                return TRUE; 
+            }        
+        }
+    }
+    return FALSE;
+}
diff --git a/CORE/MAC/src/pe/lim/limSessionUtils.h b/CORE/MAC/src/pe/lim/limSessionUtils.h
index 4127827..47484b0 100644
--- a/CORE/MAC/src/pe/lim/limSessionUtils.h
+++ b/CORE/MAC/src/pe/lim/limSessionUtils.h
@@ -58,6 +58,20 @@
 /*------------------------------------------------------------------------- 
   Function declarations and documenation
   ------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------
+  
+          \brief peGetVhtCapable() - Returns the Vht capable from a valid session.
+ 
+          This function itrates the session Table and returns the VHT capable from first valid session
+          if no sessions are valid/present  it returns FALSE
+
+         \param pMac	                - pointer to global adapter context
+          \return                        - channel to scan from valid session else zero.
+          
+          \sa
+           
+ --------------------------------------------------------------------------*/
+   tANI_U8 peGetVhtCapable(tpAniSirGlobal pMac);
 
 
 /*--------------------------------------------------------------------------
@@ -130,7 +144,68 @@
 isLimSessionOffChannel(tpAniSirGlobal pMac, tANI_U8 sessionId);
 /* --------------------------------------------------------------------------*/
 
+/*--------------------------------------------------------------------------
+  \brief peGetActiveSessionChannel() - Gets the first valid sessions primary and secondary
+                                        channel. If not found returns invalid channel ID (=0)
+  \param pMac              - pointer to global adapter context
+  \param resumeChannel     - Primary channel of the first valid session. This is an output argument.
+  \return resumePhyCbState - Secondary channel of the first valid session. This is an output argument.
+--------------------------------------------------------------------------*/
+void
+peGetActiveSessionChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState);
+
+/*--------------------------------------------------------------------------
+  \brief limIsChanSwitchRunning() - Check if channel switch is running on any  
+                                    valid session.
+
+  \param pMac                   - pointer to global adapter context
+  
+  \return tANI_U8               - 1 - if chann switching running.
+                                  0 - if chann switching is not running. 
+  
+  \sa
+  --------------------------------------------------------------------------*/
 tANI_U8
-peGetActiveSessionChannel( tpAniSirGlobal pMac );
+limIsChanSwitchRunning (tpAniSirGlobal pMac);
+
+/*--------------------------------------------------------------------------
+  \brief limIsInQuietDuration() - Check if channel quieting is running on any  
+                                    valid session.
+
+  \param pMac                   - pointer to global adapter context
+  
+  \return tANI_U8               - 1 - if chann quiet running.
+                                  0 - if chann quiet is not running. 
+  
+  \sa
+  --------------------------------------------------------------------------*/
+tANI_U8
+limIsInQuietDuration (tpAniSirGlobal pMac);
+
+/*--------------------------------------------------------------------------
+  \brief limIsQuietBegin() - Check if channel quieting is begining on any  
+                                    valid session.
+
+  \param pMac                   - pointer to global adapter context
+  
+  \return tANI_U8               - 1 - if chann quiet running.
+                                  0 - if chann quiet is not running. 
+  
+  \sa
+  --------------------------------------------------------------------------*/
+tANI_U8
+limIsQuietBegin (tpAniSirGlobal pMac);
+/*--------------------------------------------------------------------------
+  \brief limIsInMCC() - Check if Device is in MCC.
+
+  \param pMac                   - pointer to global adapter context
+  
+  \return tANI_U8               - TRUE - if in MCC.
+                                  FALSE - NOT in MCC. 
+  
+  \sa
+  --------------------------------------------------------------------------*/
+tANI_U8
+limIsInMCC (tpAniSirGlobal pMac);
 #endif //#if !defined( __LIM_SESSION_UTILS_H )
 
diff --git a/CORE/MAC/src/pe/lim/limSmeReqUtils.c b/CORE/MAC/src/pe/lim/limSmeReqUtils.c
index f0a687e..653a76d 100644
--- a/CORE/MAC/src/pe/lim/limSmeReqUtils.c
+++ b/CORE/MAC/src/pe/lim/limSmeReqUtils.c
@@ -836,6 +836,22 @@
         goto end;
     }
 
+    /*
+       Reject Join Req if the Self Mac Address and 
+       the Ap's Mac Address is same
+    */
+    if( palEqualMemory( pMac->hHdd, (tANI_U8* ) pJoinReq->selfMacAddr, 
+                       (tANI_U8 *) pJoinReq->bssDescription.bssId, 
+                       (tANI_U8) (sizeof(tSirMacAddr))))
+    {
+        // Log the event
+        limLog(pMac, LOGE,
+               FL("received SME_JOIN_REQ with Self Mac and BSSID Same\n"));
+
+        valid = false;
+        goto end;
+    }
+
 end:
     return valid;
 } /*** end limIsSmeJoinReqValid() ***/
diff --git a/CORE/MAC/src/pe/lim/limTimerUtils.c b/CORE/MAC/src/pe/lim/limTimerUtils.c
index fd0b2a5..e2003cf 100644
--- a/CORE/MAC/src/pe/lim/limTimerUtils.c
+++ b/CORE/MAC/src/pe/lim/limTimerUtils.c
@@ -895,7 +895,7 @@
 {
     tANI_U32    val=0, val1=0;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, timerId));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
 
     switch (timerId)
     {
@@ -920,6 +920,7 @@
                        FL("Unable to deactivate min channel timer\n"));
             }
 
+#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
@@ -933,6 +934,7 @@
             }
             else
             {
+#endif
                 if(pMac->lim.gpLimMlmScanReq)
                 {
                     val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
@@ -943,7 +945,9 @@
                     //No need to change min timer. This is not a scan
                     break;
                 }
+#if 0
             }
+#endif
 
             if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
                                 val, 0) != TX_SUCCESS)
@@ -993,6 +997,7 @@
             // was specified
             if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
             {
+#if 0
 
                 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
                     pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
@@ -1003,6 +1008,7 @@
                 }
                 else
                 {
+#endif
                     if(pMac->lim.gpLimMlmScanReq)
                     {
                         val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
@@ -1013,7 +1019,9 @@
                         //No need to change max timer. This is not a scan
                         break;
                     }
+#if 0
                 }
+#endif
             }
 #endif
 #if defined(ANI_PRODUCT_TYPE_AP)
@@ -1415,6 +1423,7 @@
             break;
 
 #endif
+#if 0
         case eLIM_CHANNEL_SWITCH_TIMER:
             if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
             {
@@ -1430,6 +1439,7 @@
                 return;
             }
             break;
+#endif
 
         case eLIM_LEARN_DURATION_TIMER:
 #ifdef ANI_PRODUCT_TYPE_AP
@@ -1484,6 +1494,7 @@
 #endif
             break;
 
+#if 0
         case eLIM_QUIET_BSS_TIMER:
             if (TX_SUCCESS !=
             tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
@@ -1519,7 +1530,7 @@
                     FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
             }
             break;
-
+#endif
 
 #ifdef WLAN_SOFTAP_FEATURE
 #if 0
@@ -1635,7 +1646,7 @@
 {
     tANI_U32    val, val1;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
 
     if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
         limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer \n"));
@@ -1679,7 +1690,7 @@
     PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"), psessionEntry->LimRxedBeaconCntDuringHB);)
 
     limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+    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) {
@@ -1850,7 +1861,7 @@
 limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
 {
     tANI_U32    val;
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, timerId));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
 
     switch (timerId)
     {
@@ -1995,7 +2006,7 @@
 
 void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
 {
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_CNF_WAIT_TIMER));
+    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)
@@ -2027,7 +2038,7 @@
 
 void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
 {
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_AUTH_RESP_TIMER));
+    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.
diff --git a/CORE/MAC/src/pe/lim/limTypes.h b/CORE/MAC/src/pe/lim/limTypes.h
index cebffee..3f08943 100644
--- a/CORE/MAC/src/pe/lim/limTypes.h
+++ b/CORE/MAC/src/pe/lim/limTypes.h
@@ -100,6 +100,10 @@
 #define LIM_MLM_REMOVEKEY_REQ  LIM_MLM_MSG_START + 39
 #define LIM_MLM_REMOVEKEY_CNF  LIM_MLM_MSG_START + 40
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+#define LIM_MLM_OEM_DATA_REQ            LIM_MLM_MSG_START + 41
+#define LIM_MLM_OEM_DATA_CNF            LIM_MLM_MSG_START + 42
+#endif
 
 #define LIM_HASH_ADD            0
 #define LIM_HASH_UPDATE         1
@@ -174,7 +178,7 @@
     tANI_U8               dtimPeriod;
     tSirMacCfParamSet     cfParamSet;
     tSirMacChanNum        channelNumber;
-    tAniCBSecondaryMode   cbMode;
+    ePhyChanBondState     cbMode;
     tANI_U16              atimWindow;
     tSirMacRateSet        rateSet;
     tANI_U8               sessionId; //Added For BT-AMP Support   
@@ -244,8 +248,6 @@
     tSirRSNie            rsnIE;
     tSirAddie            addIE; // additional IE recevied from the peer, which possibly includes WSC IE and/or P2P IE.
     tSirMacCapabilityInfo capabilityInfo;
-    tAniTitanHtCapabilityInfo titanHtCaps;
-
     tAniBool                spectrumMgtIndicator;
     tSirMacPowerCapInfo     powerCap;
     tSirSupChnl             supportedChannels;
@@ -300,8 +302,6 @@
     tSirRSNie            rsnIE;
     tSirAddie            addIE; // additional IE recevied from the peer, which can be WSC IE and/or P2P IE.
     tSirMacCapabilityInfo capabilityInfo;
-    tAniTitanHtCapabilityInfo titanHtCaps;
-
     tAniBool                spectrumMgtIndicator;
     tSirMacPowerCapInfo     powerCap;
     tSirSupChnl             supportedChannels;
@@ -647,11 +647,8 @@
 
 void limGetRandomBssid(tpAniSirGlobal pMac ,tANI_U8 *data);
 
-// Function to handle CB CFG parameter updates
-void handleCBCFGChange( tpAniSirGlobal pMac, tANI_U32 cfgId );
-
 // Function to handle HT and HT IE CFG parameter intializations
-void handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac);
+void handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry);
 
 // Function to handle CFG parameter updates
 void limHandleCFGparamUpdate(tpAniSirGlobal, tANI_U32);
@@ -675,7 +672,6 @@
 // Function to cleanup LMM state machine
 void limCleanupLmm(tpAniSirGlobal);
 
-
 // Management frame handling functions
 void limProcessBeaconFrame(tpAniSirGlobal, tANI_U8 *,tpPESession);
 void limProcessBeaconFrameNoSession(tpAniSirGlobal, tANI_U8 *);
@@ -734,8 +730,8 @@
 void limContinueChannelScan(tpAniSirGlobal);
 tSirResultCodes limMlmAddBss(tpAniSirGlobal, tLimMlmStartReq *,tpPESession psessionEntry);
 
-#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
-tSirRetStatus limSendChannelSwitchMgmtFrame(tpAniSirGlobal, tSirMacAddr, tANI_U8, tANI_U8, tANI_U8);
+#if 1 //(WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+tSirRetStatus limSendChannelSwitchMgmtFrame(tpAniSirGlobal, tSirMacAddr, tANI_U8, tANI_U8, tANI_U8, tpPESession);
 #endif
 
 #if defined WLAN_FEATURE_VOWIFI
@@ -789,11 +785,15 @@
 void limSetScanMode(tpAniSirGlobal pMac);
 
 /// Function that Switches the Channel and sets the CB Mode 
-void limSetChannel(tpAniSirGlobal pMac, tANI_U32 titanHtcap, tANI_U8 channel, tPowerdBm maxTxPower, tANI_U8 peSessionId);
+void limSetChannel(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 secChannelOffset, tPowerdBm maxTxPower, tANI_U8 peSessionId);
 
 /// Function that completes channel scan
 void limCompleteMlmScan(tpAniSirGlobal, tSirResultCodes);
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+/// Funtion that sets system into meas mode for oem data req
+void limSetOemDataReqMode(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* data);
+#endif
 
 #ifdef ANI_SUPPORT_11H
 /// Function that sends Measurement Report action frame
@@ -811,11 +811,6 @@
 void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQt,tpPESession psessionEntry);
 void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
 void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession);
-#ifdef ANI_PRODUCT_TYPE_AP
-void limProcessApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
-void limProcessApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
-void limProcessApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
-#endif
 void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
 void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry);
 void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
@@ -1077,7 +1072,7 @@
 void limSendSmeMgmtFrameInd(
                     tpAniSirGlobal pMac, tANI_U8 frameType,
                     tANI_U8  *frame, tANI_U32 frameLen, tANI_U16 sessionId,
-                    tANI_U32 rxChan);
+                    tANI_U32 rxChan, tpPESession psessionEntry);
 void limProcessRemainOnChnTimeout(tpAniSirGlobal pMac);
 void limSendP2PActionFrame(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
 void limAbortRemainOnChan(tpAniSirGlobal pMac);
diff --git a/CORE/MAC/src/pe/lim/limUtils.c b/CORE/MAC/src/pe/lim/limUtils.c
index ea634e9..d0f8d04 100644
--- a/CORE/MAC/src/pe/lim/limUtils.c
+++ b/CORE/MAC/src/pe/lim/limUtils.c
@@ -442,6 +442,12 @@
             return "eWNI_SME_SYS_READY_IND\n";
         case eWNI_SME_SCAN_REQ:
             return "eWNI_SME_SCAN_REQ\n";
+#ifdef FEATURE_OEM_DATA_SUPPORT
+        case eWNI_SME_OEM_DATA_REQ:
+            return "eWNI_SME_OEM_DATA_REQ\n";
+        case eWNI_SME_OEM_DATA_RSP:
+            return "eWNI_SME_OEM_DATA_RSP\n";
+#endif
         case eWNI_SME_SCAN_RSP:
             return "eWNI_SME_SCAN_RSP\n";
         case eWNI_SME_JOIN_REQ:
@@ -539,10 +545,6 @@
         case eWNI_SME_DELTS_IND:
             return "eWNI_SME_DELTS_IND\n";
 
-        case SIR_LIM_RESUME_ACTIVITY_NTF:
-            return "SIR_LIM_RESUME_ACTIVITY_NTF\n";
-        case SIR_LIM_SUSPEND_ACTIVITY_REQ:
-            return "SIR_LIM_SUSPEND_ACTIVITY_REQ\n";
         case WDA_SUSPEND_ACTIVITY_RSP:
             return "WDA_SUSPEND_ACTIVITY_RSP\n";
         case SIR_LIM_RETRY_INTERRUPT_MSG:
@@ -571,22 +573,10 @@
             return "SIR_LIM_REASSOC_FAIL_TIMEOUT\n";
         case SIR_LIM_HEART_BEAT_TIMEOUT:
             return "SIR_LIM_HEART_BEAT_TIMEOUT\n";
-#ifdef ANI_PRODUCT_TYPE_AP
-        case SIR_LIM_PREAUTH_CLNUP_TIMEOUT:
-            return "SIR_LIM_PREAUTH_CLNUP_TIMEOUT\n";
-#endif
         case SIR_LIM_ADDTS_RSP_TIMEOUT:
             return "SIR_LIM_ADDTS_RSP_TIMEOUT\n";
         case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
             return "SIR_LIM_CHANNEL_SCAN_TIMEOUT\n";
-#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
-        case SIR_LIM_MEASUREMENT_IND_TIMEOUT:
-            return "SIR_LIM_MEASUREMENT_IND_TIMEOUT\n";
-        case SIR_LIM_LEARN_INTERVAL_TIMEOUT:
-            return "SIR_LIM_LEARN_INTERVAL_TIMEOUT\n";
-        case SIR_LIM_LEARN_DURATION_TIMEOUT:
-            return "SIR_LIM_LEARN_DURATION_TIMEOUT\n";
-#endif
         case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
             return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT\n";
         case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
@@ -895,7 +885,7 @@
 void
 limInitMlm(tpAniSirGlobal pMac)
 {
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
 
     /// Initialize scan result hash table
     limReInitScanResults(pMac); //sep26th review
@@ -1358,7 +1348,7 @@
     **/
     if (pMac->lim.gLimDeferredMsgQ.size > 0)
     {
-        PELOGW(limLog(pMac, LOGW, FL("%d Deferred messages (type 0x%x, scan %d, sme %d, mlme %d, addts %d)\n"),
+        PELOGW(limLog(pMac, LOGW, FL("%d Deferred messages (type 0x%x, scan %d, global sme %d, global mlme %d, addts %d)\n"),
                pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
                limIsSystemInScanState(pMac),
                pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
@@ -1467,7 +1457,7 @@
            pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
            msg->type);)
 
-   PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, sme %d, mlme %d, addts %d\n"),
+   PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d\n"),
            limIsSystemInScanState(pMac),
            pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
            pMac->lim.gLimAddtsSent);)
@@ -1898,7 +1888,7 @@
     {
         //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
         //HT20 case is common between both the bands and handled down as common code.
-        if(true == psessionEntry->htCapabality)
+        if(true == psessionEntry->htCapability)
         {
             //we are 11N and 11A station is joining.        
             //protection from 11A required.            
@@ -1915,7 +1905,7 @@
 
         //We are 11G. Check if we need protection from 11b Stations.
         if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
-              (false == psessionEntry->htCapabality))
+              (false == psessionEntry->htCapability))
         {
 
             if (pStaDs->erpEnabled== eHAL_CLEAR)
@@ -1928,7 +1918,7 @@
         }
 
         //HT station.
-        if (true == psessionEntry->htCapabality)
+        if (true == psessionEntry->htCapability)
         {
             //check if we need protection from 11b station
             if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
@@ -1953,7 +1943,7 @@
     }
 
     //we are HT and HT station is joining. This code is common for both the bands.
-    if((true == psessionEntry->htCapabality) &&
+    if((true == psessionEntry->htCapability) &&
         (true == pStaDs->mlmStaContext.htCapability))
     {
         if(!pStaDs->htGreenfield)
@@ -2144,18 +2134,21 @@
     tpDphHashNode    pStaDs;
     tANI_U32 phyMode;
     tANI_U32 val;
-    tANI_U32 cShortSlot;
     tANI_U16 i;
 
     // check whether to enable protection or not
     pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
     limGetPhyMode(pMac, &phyMode, psessionEntry);
 
+    /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
+     * be always 1 and in 11b case, it should be always 0
+     */
     if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
     {
-        if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &cShortSlot) != eSIR_SUCCESS)
-            limLog(pMac, LOGP, FL("unable to get short slot time\n"));
-
+        /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
+         * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
+         * it in limDecideShortSlot
+         */
         if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
         {
             PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
@@ -2234,27 +2227,28 @@
             wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
 
 #ifdef WLAN_SOFTAP_FEATURE
+            /* Here we check if we are AP role and short slot enabled (both admin and oper modes) but we have atleast one STA connected with
+             * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
+             */
             if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) && 
-                 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && cShortSlot))
+                 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
             {
                 // enable long slot time
                 pBeaconParams->fShortSlotTime = false;
                 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
                 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time.\n"));)
-                if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, false) != eSIR_SUCCESS)
-                    PELOGE(limLog(pMac, LOGE,   FL("could not update short slot time at CFG\n"));)
+                psessionEntry->shortSlotTimeSupported = false;
             }
             else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
 #endif            
             {
-                if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && cShortSlot)
+                if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
                 {
                     // enable long slot time
                     pBeaconParams->fShortSlotTime = false;
                     pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
                     PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time.\n"));)
-                    if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, false) != eSIR_SUCCESS)
-                        PELOGE(limLog(pMac, LOGE,   FL("could not update short slot time at CFG\n"));)
+                    psessionEntry->shortSlotTimeSupported = false;
                  }
             }
         }
@@ -2414,7 +2408,7 @@
             }
         }
         //following code block is only for HT station.
-        if((psessionEntry->htCapabality) &&
+        if((psessionEntry->htCapability) &&
               (pBeaconStruct->HTInfo.present))
         {
             tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
@@ -2457,7 +2451,7 @@
     }
 
     //protection related factors other than HT operating mode. Applies to 2.4 GHZ as well as 5 GHZ.
-    if((psessionEntry->htCapabality) &&
+    if((psessionEntry->htCapability) &&
           (pBeaconStruct->HTInfo.present))
     {
         tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
@@ -2492,7 +2486,7 @@
     if(SIR_BAND_5_GHZ == rfBand)
     {
         //we are HT capable.
-        if((true == psessionEntry->htCapabality) &&
+        if((true == psessionEntry->htCapability) &&
             (pBeaconStruct->HTInfo.present))
         {
             //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.        
@@ -2542,7 +2536,7 @@
          }
 
         //following code block is only for HT station.
-        if((psessionEntry->htCapabality) &&
+        if((psessionEntry->htCapability) &&
               (pBeaconStruct->HTInfo.present))
         {
           
@@ -2586,7 +2580,7 @@
     }
 
     //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
-    if((psessionEntry->htCapabality) &&
+    if((psessionEntry->htCapability) &&
           (pBeaconStruct->HTInfo.present))
     {
         tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;    
@@ -2648,7 +2642,7 @@
 {
     tpPESession psessionEntry = NULL;
 #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
-    tANI_U8    channel = pMac->lim.gLimChannelSwitch.primaryChannel;   // This is received and stored from channelSwitch Action frame
+    tANI_U8    channel; // This is received and stored from channelSwitch Action frame
    
     if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL) 
     {
@@ -2661,6 +2655,7 @@
         PELOGW(limLog(pMac, LOGW, "Channel switch can be done only in STA role, Current Role = %d\n", psessionEntry->limSystemRole);)
         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
@@ -2673,10 +2668,10 @@
     }
          
     // Restore Channel Switch parameters to default
-    pMac->lim.gLimChannelSwitch.switchTimeoutValue = 0;
+    psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
 
     /* Channel-switch timeout has occurred. reset the state */
-    pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
+    psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
     
     /* 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 
@@ -2700,28 +2695,28 @@
                         eSIR_MAC_UNSPEC_FAILURE_REASON);
         return;
     }
-    switch(pMac->lim.gLimChannelSwitch.state)
+    switch(psessionEntry->gLimChannelSwitch.state)
     {
         case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
             PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY \n"));)
-            limSwitchPrimaryChannel(pMac, pMac->lim.gLimChannelSwitch.primaryChannel,psessionEntry);
-            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+            limSwitchPrimaryChannel(pMac, psessionEntry->gLimChannelSwitch.primaryChannel,psessionEntry);
+            psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
             break;
 
         case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
             PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY \n"));)
-            limSwitchPrimarySecondaryChannel(pMac,
+            limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
                                              psessionEntry->currentOperChannel,
-                                             pMac->lim.gLimChannelSwitch.secondarySubBand);
-            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+                                             psessionEntry->gLimChannelSwitch.secondarySubBand);
+            psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
             break;
 
         case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
             PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY\n"));)
-            limSwitchPrimarySecondaryChannel(pMac,
-                                             pMac->lim.gLimChannelSwitch.primaryChannel,
-                                             pMac->lim.gLimChannelSwitch.secondarySubBand);
-            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+            limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
+                                             psessionEntry->gLimChannelSwitch.primaryChannel,
+                                             psessionEntry->gLimChannelSwitch.secondarySubBand);
+            psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
             break;
 
         case eLIM_CHANNEL_SWITCH_IDLE:
@@ -2734,7 +2729,7 @@
             return;  /* Please note, this is 'return' and not 'break' */
     }
 #endif
-    }
+}
 
 /**
  * limUpdateChannelSwitch()
@@ -2754,18 +2749,11 @@
 {
 
     tANI_U16                         beaconPeriod;
-    tANI_U32                         val;
     tChannelSwitchPropIEStruct       *pPropChnlSwitch;
     tDot11fIEChanSwitchAnn           *pChnlSwitch;
 
  
-
-    if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &val) != eSIR_SUCCESS)
-    {
-        limLog(pMac, LOGP, FL("Could not retrieve Beacon interval\n"));
-        return;
-    }
-    beaconPeriod = (tANI_U16) val;
+    beaconPeriod = psessionEntry->beaconParams.beaconInterval;
 
     /* STA either received proprietary channel switch IE or 802.11h
      * standard channel switch IE.
@@ -2776,53 +2764,42 @@
 
         /* Add logic to determine which change this is:  */
         /*      primary, secondary, both.  For now assume both. */
-        pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
-        pMac->lim.gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
-        pMac->lim.gLimChannelSwitch.secondarySubBand = (tAniCBSecondaryMode)pPropChnlSwitch->subBand;
-        pMac->lim.gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
-        pMac->lim.gLimChannelSwitch.switchTimeoutValue =
+        psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+        psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
+        psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
+        psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
+        psessionEntry->gLimChannelSwitch.switchTimeoutValue =
                  SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
-        pMac->lim.gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
+        psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
     }
     else
     {
        pChnlSwitch = &(pBeacon->channelSwitchIE);
-       pMac->lim.gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
-       pMac->lim.gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
-       pMac->lim.gLimChannelSwitch.switchTimeoutValue =
+       psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
+       psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
+       psessionEntry->gLimChannelSwitch.switchTimeoutValue =
                  SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
-       pMac->lim.gLimChannelSwitch.switchMode = pChnlSwitch->switchMode; 
+       psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode; 
 
         /* Only primary channel switch element is present */
-        pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
-        pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_NONE;
+        psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
+        psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
 
         /* Do not bother to look and operate on extended channel switch element
          * if our own channel-bonding state is not enabled
          */
-        if(GET_CB_ADMIN_STATE(pMac->lim.gCbState))
+        if (psessionEntry->htSupportedChannelWidthSet)
         {
             if (pBeacon->extChannelSwitchPresent)
             {
-                switch(pBeacon->extChannelSwitchIE.secondaryChannelOffset)
+                if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) || 
+                    (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
                 {
-                    case eHT_SECONDARY_CHANNEL_OFFSET_UP:
-                        pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
-                        pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_UP;
-                        break;
-
-                    case eHT_SECONDARY_CHANNEL_OFFSET_DOWN:
-                        pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
-                        pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_DOWN;
-                        break;
-
-                    case eHT_SECONDARY_CHANNEL_OFFSET_NONE:
-                    default:
-                        /* Nothing to be done here as of now!! */
-                        break;
+                    psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+                    psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
                 }
-           }
-       }
+            }
+        }
     }
 
     if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
@@ -2831,11 +2808,12 @@
     }
 
     limLog(pMac, LOGW,
-        FL("primary chl %d, subband %d, count  %d (%d ticks) \n"),
-        pMac->lim.gLimChannelSwitch.primaryChannel,
-        pMac->lim.gLimChannelSwitch.secondarySubBand,
-        pMac->lim.gLimChannelSwitch.switchCount,
-        pMac->lim.gLimChannelSwitch.switchTimeoutValue);
+        FL("session %d primary chl %d, subband %d, count  %d (%d ticks) \n"),
+        psessionEntry->peSessionId,
+        psessionEntry->gLimChannelSwitch.primaryChannel,
+        psessionEntry->gLimChannelSwitch.secondarySubBand,
+        psessionEntry->gLimChannelSwitch.switchCount,
+        psessionEntry->gLimChannelSwitch.switchTimeoutValue);
     return;
 }
 
@@ -2864,7 +2842,7 @@
         return;
         
     PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE\n"));)
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_CHANNEL_SWITCH_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
 
     if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
     {
@@ -2894,17 +2872,17 @@
     if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
         return;
 
-    if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) 
+    if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) 
     {
-         MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_TIMER));
+         MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
         {
             PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed\n"));)
         }
     }
-    else if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
+    else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
         {
             PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed\n"));)
@@ -2913,14 +2891,14 @@
          * If the channel switch is already running in silent mode, dont resume the
          * transmission. Channel switch timer when timeout, transmission will be resumed.
          */
-        if(!((pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
-                (pMac->lim.gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
+        if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
+                (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
         {
             limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
-            limRestorePreQuietState(pMac);
+            limRestorePreQuietState(pMac, psessionEntry);
         }
     }
-    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+    psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
 #endif
 }
 
@@ -2955,25 +2933,40 @@
  */
 void limProcessQuietTimeout(tpAniSirGlobal pMac)
 {
-#ifdef GEN6_TODO
     //fetch the sessionEntry based on the sessionId
     //priority - MEDIUM
-    tpPESession sessionEntry;
+    tpPESession psessionEntry;
 
-    if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL) 
+    if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL) 
     {
-        limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+        limLog(pMac, LOGE,FL("Session Does not exist for given sessionID\n"));
         return;
     }
-#endif
 
-  PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), pMac->lim.gLimSpecMgmt.quietState);)
-  switch( pMac->lim.gLimSpecMgmt.quietState )
+  PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), psessionEntry->gLimSpecMgmt.quietState);)
+  switch( psessionEntry->gLimSpecMgmt.quietState )
   {
     case eLIM_QUIET_BEGIN:
       // Time to Stop data traffic for quietDuration
-      limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
-      MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
+      //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
+      if (TX_SUCCESS !=
+      tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
+      {
+          limLog( pMac, LOGE,
+            FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway...\n"));
+      }
+
+      // gLimQuietDuration appears to be in units of ticks
+      // Use it as is
+      if (TX_SUCCESS !=
+          tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
+            psessionEntry->gLimSpecMgmt.quietDuration,
+            0))
+      {
+          limLog( pMac, LOGE,
+            FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway...\n"));
+      }
+      MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_QUIET_BSS_TIMER));
 #ifdef GEN6_TODO
         /* revisit this piece of code to assign the appropriate sessionId below
          * priority - HIGH
@@ -2989,7 +2982,7 @@
       else
       {
         // Transition to eLIM_QUIET_RUNNING
-        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
+        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
 
         /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
         /* print message, otherwise, stop data traffic and stay quiet */
@@ -3007,7 +3000,7 @@
 
            limLog( pMac, LOG2,
                 FL("Quiet BSS: STA shutting down for %d ticks\n"),
-                pMac->lim.gLimSpecMgmt.quietDuration );
+                psessionEntry->gLimSpecMgmt.quietDuration );
         }
       }
       break;
@@ -3063,57 +3056,57 @@
  */
 void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
 {
-    tpPESession sessionEntry;
+    tpPESession psessionEntry;
 
-    if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL) 
+    if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL) 
     {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
         return;
     }
 
-  PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), pMac->lim.gLimSpecMgmt.quietState);)
-  if (eLIM_AP_ROLE == sessionEntry->limSystemRole)
+  PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), psessionEntry->gLimSpecMgmt.quietState);)
+  if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
   {
 #ifdef ANI_PRODUCT_TYPE_AP
     if (!pMac->sys.gSysEnableLearnMode)
     {
-        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
+        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_END;
         return;
     }
 
-    if( eLIM_QUIET_INIT == pMac->lim.gLimSpecMgmt.quietState )
+    if( eLIM_QUIET_INIT == psessionEntry->gLimSpecMgmt.quietState )
     {
         //QuietCount = 0 is reserved
-        pMac->lim.gLimSpecMgmt.quietCount  = 2;
+        psessionEntry->gLimSpecMgmt.quietCount  = 2;
         // In ms.
-        pMac->lim.gLimSpecMgmt.quietDuration = 
+        psessionEntry->gLimSpecMgmt.quietDuration = 
         pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration;
         // TU is in multiples of 1024 (2^10) us.
-        pMac->lim.gLimSpecMgmt.quietDuration_TU = 
-            SYS_MS_TO_TU(pMac->lim.gLimSpecMgmt.quietDuration); 
+        psessionEntry->gLimSpecMgmt.quietDuration_TU = 
+            SYS_MS_TO_TU(psessionEntry->gLimSpecMgmt.quietDuration); 
         // Transition to eLIM_QUIET_BEGIN
         limLog( pMac, LOG2, FL("Quiet BSS state = eLIM_QUIET_BEGIN\n"));
-        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN;
+        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN;
     }
 #endif
   }
   else
   {
     // eLIM_STA_ROLE
-    switch( pMac->lim.gLimSpecMgmt.quietState )
+    switch( psessionEntry->gLimSpecMgmt.quietState )
     {
       case eLIM_QUIET_RUNNING:
         // Transition to eLIM_QUIET_INIT
-        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
 
         if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
         {
           // Resume data traffic only if channel switch is not running in silent mode.
-          if (!((pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
-                  (pMac->lim.gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
+          if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
+                  (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
           {
               limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
-              limRestorePreQuietState(pMac);
+              limRestorePreQuietState(pMac, psessionEntry);
           }
       
           /* Reset status flag */
@@ -3141,8 +3134,8 @@
         PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING\n"));)
         /* If the quiet period has ended, then resume the frame transmission */
         limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
-        limRestorePreQuietState(pMac);
-        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+        limRestorePreQuietState(pMac, psessionEntry);
+        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
         break;
 
       default:
@@ -3244,8 +3237,8 @@
         return;
     
    PELOG1(limLog(pMac, LOG1, FL("Quiet state = %d, Quiet Count = %d\n"),
-        pMac->lim.gLimSpecMgmt.quietState, pQuietIE->count);)
-    if (!pMac->lim.gLim11hEnable)
+        psessionEntry->gLimSpecMgmt.quietState, pQuietIE->count);)
+    if (!psessionEntry->lim11hEnable)
         return;
     // The (Titan) AP is requesting this (Titan) STA to
     // honor this Quiet IE REQ and shut-off Tx/Rx. If we're
@@ -3267,26 +3260,26 @@
         beaconPeriod = (tANI_U16) val;
 
      /* (qd * 2^10)/1000 */
-    pMac->lim.gLimSpecMgmt.quietDuration_TU = pQuietIE->duration;
+    psessionEntry->gLimSpecMgmt.quietDuration_TU = pQuietIE->duration;
     // The STA needs to shut-off Tx/Rx "for" this interval (in milliSeconds)
     /* Need to convert from TU to system TICKS */
-    pMac->lim.gLimSpecMgmt.quietDuration = SYS_MS_TO_TICKS(
-                           SYS_TU_TO_MS(pMac->lim.gLimSpecMgmt.quietDuration_TU));
+    psessionEntry->gLimSpecMgmt.quietDuration = SYS_MS_TO_TICKS(
+                           SYS_TU_TO_MS(psessionEntry->gLimSpecMgmt.quietDuration_TU));
 
-    if (pMac->lim.gLimSpecMgmt.quietDuration_TU == 0)
+    if (psessionEntry->gLimSpecMgmt.quietDuration_TU == 0)
     {
         PELOG1(limLog(pMac, LOG1, FL("Zero duration in quiet IE\n"));)
         return;
     }
     
     // The STA needs to shut-off Tx/Rx "after" this interval
-    pMac->lim.gLimSpecMgmt.quietTimeoutValue =
+    psessionEntry->gLimSpecMgmt.quietTimeoutValue =
               (beaconPeriod * pQuietIE->count) + pQuietIE->offset;
 
     limLog( pMac, LOG2,
         FL( "STA shut-off will begin in %d milliseconds & last for %d ticks\n"),
-        pMac->lim.gLimSpecMgmt.quietTimeoutValue,
-        pMac->lim.gLimSpecMgmt.quietDuration );
+        psessionEntry->gLimSpecMgmt.quietTimeoutValue,
+        psessionEntry->gLimSpecMgmt.quietDuration );
 
     /* Disable, Stop background scan if enabled and running */
     limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
@@ -3308,7 +3301,7 @@
         }
         else
         {
-            limRestorePreQuietState(pMac);
+            limRestorePreQuietState(pMac, psessionEntry);
         }
     }
     else
@@ -3319,7 +3312,7 @@
     }
     
     // Transition to eLIM_QUIET_BEGIN
-    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN;
+    psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN;
 #endif
 }
 
@@ -3348,17 +3341,29 @@
     // First, de-activate Timer, if its already active
     limCancelDot11hQuiet(pMac, psessionEntry);
     
-    limDeactivateAndChangeTimer(pMac, eLIM_QUIET_TIMER);
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_QUIET_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
+    if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
+    {
+        limLog( pMac, LOGE,
+            FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
+    }
+
+    // Set the NEW timeout value, in ticks
+    if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
+                      SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
+    {
+        limLog( pMac, LOGE,
+            FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
+    }
     
     pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
     if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
     {
         limLog( pMac, LOGE,
             FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!\n"));
-        limRestorePreQuietState(pMac);
+        limRestorePreQuietState(pMac, psessionEntry);
 
-        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
         return;
     }
 #endif
@@ -3468,59 +3473,6 @@
     schEdcaProfileUpdate(pMac, psessionEntry);
 }
 
-/** -------------------------------------------------------------
-\fn limGetHtCbAdminState
-\brief provides CB Admin state
-\param     tpAniSirGlobal    pMac
-\param     tDot11fIEHTCaps htCaps,
-\param     tANI_U8 *titanHtCaps 
-\return     none
-  -------------------------------------------------------------*/
-void limGetHtCbAdminState( tpAniSirGlobal pMac,
-        tDot11fIEHTCaps htCaps,
-        tANI_U8 *titanHtCaps )
-{
-    // Extract secondary channel info wrt Channel Bonding
-    if(htCaps.supportedChannelWidthSet)
-        SME_SET_CB_ADMIN_STATE( *titanHtCaps, eHAL_SET );    
-    else
-        SME_SET_CB_ADMIN_STATE( *titanHtCaps, eHAL_CLEAR);
-    
-
-  // And the final TITAN HT capabilities bitmap is...
-  limLog( pMac, LOG2,
-      FL("TITAN HT capabilities in BSS Description = %1d\n"),
-        *titanHtCaps);
-}
-/** -------------------------------------------------------------
-\fn limGetHtCbOpState
-\brief provides CB operational state
-\param     tpAniSirGlobal    pMac
-\param     tDot11fIEHTInfo htInfo,
-\param     tANI_U8 *titanHtCaps
-\return     none
-  -------------------------------------------------------------*/
-void limGetHtCbOpState( tpAniSirGlobal pMac,
-        tDot11fIEHTInfo htInfo,
-        tANI_U8 *titanHtCaps )
-{
-    // Extract secondary channel info wrt Channel Bonding
-    if(htInfo.secondaryChannelOffset)
-    {
-      if(PHY_DOUBLE_CHANNEL_LOW_PRIMARY == htInfo.secondaryChannelOffset)
-          SME_SET_CB_OPER_STATE( *titanHtCaps,
-            eANI_CB_SECONDARY_UP );
-      else if(PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == htInfo.secondaryChannelOffset)
-          SME_SET_CB_OPER_STATE( *titanHtCaps,
-            eANI_CB_SECONDARY_DOWN );
-    }
-
-  // And the final TITAN HT capabilities bitmap is...
-  limLog( pMac, LOG2,
-      FL("TITAN HT capabilities in BSS Description = %1d\n"),
-        *titanHtCaps);
-}
-
 /**
  * limSwitchChannelCback()
  *
@@ -3541,9 +3493,6 @@
    tSirMsgQ    mmhMsg = {0};
    tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
 
-   PELOG1(limLog(pMac, LOG1,FL("Sending message %s with reasonCode %s\n"),
-                    limMsgStr(msgType), limResultCodeStr(resultCode));)
-
    psessionEntry->currentOperChannel = psessionEntry->currentReqChannel; 
    
    /* We need to restore pre-channelSwitch state on the STA */
@@ -3562,14 +3511,14 @@
   
    pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
    pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
-   pSirSmeSwitchChInd->newChannelId = pMac->lim.gLimChannelSwitch.primaryChannel;
+   pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
    pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
    //BSS ID
    palCopyMemory( pMac->hHdd, pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
    mmhMsg.bodyptr = pSirSmeSwitchChInd;
    mmhMsg.bodyval = 0;
    
-   MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
    
 #if defined( FEATURE_WLAN_INTEGRATED_SOC )
    SysProcessMmhMsg(pMac, &mmhMsg);
@@ -3611,7 +3560,7 @@
     pMac->lim.gpchangeChannelData = NULL;
 
 #if defined WLAN_FEATURE_VOWIFI  
-    limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE,
+    limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
                                                    psessionEntry->maxTxPower, psessionEntry->peSessionId);
 #else
     if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
@@ -3619,7 +3568,7 @@
         limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg\n" ));
         return;
     }
-    limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE,
+    limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
                                                    (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
 #endif
     return;
@@ -3644,13 +3593,12 @@
  *                       - eANI_CB_SECONDARY_DOWN
  * @return NONE
  */
-void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel, tAniCBSecondaryMode subband)
+void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
 {
 #if !defined WLAN_FEATURE_VOWIFI  
     tANI_U32 localPwrConstraint;
 #endif
 
-    tpPESession psessionEntry =  &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
 #if !defined WLAN_FEATURE_VOWIFI  
     if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
         limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg\n" ));
@@ -3658,95 +3606,36 @@
     }
 #endif
 
-    switch(subband)
-    {
-        case eANI_CB_SECONDARY_NONE:
-            PELOGW(limLog(pMac, LOGW, FL("Disable CB SECONDARY\n"));)
-            /* If CB was on, turn it off, otherwise, do nothing */
-            if(GET_CB_OPER_STATE(pMac->lim.gCbState))
-            {
-                /* Turn off CB in HW and SW.  SW and HW cbstate must match!  Otherwise, will hit ASSERT case */
-                SET_CB_OPER_STATE(pMac->lim.gCbState, eHAL_CLEAR);
-                /* Clean up station entry if we're not STA */
-            }
-            if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE) != eSIR_SUCCESS)
-                limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
-
 #if defined WLAN_FEATURE_VOWIFI  
-            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+                limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
 #else
-            //Send Message to HAL to update the channel
-            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
+                limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
 #endif
-            break;
 
-        case eANI_CB_SECONDARY_UP:
-            PELOGW(limLog(pMac, LOGW, FL("Switch CB SECONDARY to UP.\n"));)
-            SET_CB_SEC_CHANNEL(pMac->lim.gCbState, eHAL_SET);
-            if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER) != eSIR_SUCCESS)
-                limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
-
-            /* If CB was off, turn it on, otherwise, do nothing */
-            if(!GET_CB_OPER_STATE(pMac->lim.gCbState))
-            {
-                /* Turn on CB in HW and SW.  SW and HW cbstate must match!  Otherwise, will hit ASSERT case */
-                SET_CB_OPER_STATE(pMac->lim.gCbState, eHAL_SET);
-            }
-            //Send Message to HAL to update the channel
-            //enums for secondary channel offset for Titan and 11n are different
-#if defined WLAN_FEATURE_VOWIFI  
-            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_UP, psessionEntry->maxTxPower, psessionEntry->peSessionId);
-#else
-            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_UP, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
-#endif
-            break;
-
-        case eANI_CB_SECONDARY_DOWN:
-            PELOGW(limLog(pMac, LOGW, FL("Switch CB SECONDARY to LOWER.\n"));)
-            SET_CB_SEC_CHANNEL(pMac->lim.gCbState, eHAL_CLEAR);
-            if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER) != eSIR_SUCCESS)
-                limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
-            /* If CB was off, turn it on, otherwise, do nothing */
-            if(!GET_CB_OPER_STATE(pMac->lim.gCbState))
-            {
-                /* Turn on CB in HW and SW.  SW and HW cbstate must match!  Otherwise, will hit ASSERT case */
-                SET_CB_OPER_STATE(pMac->lim.gCbState, eHAL_SET);
-                /* Update station entry if we're not STA */
-            }
-            //Send Message to HAL to update the channel
-            //enums for secondary channel offset for Titan and 11n are different
-#if defined WLAN_FEATURE_VOWIFI  
-            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE, psessionEntry->maxTxPower, psessionEntry->peSessionId);
-#else
-            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_DOWN, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
-#endif
-            break;
-
-        case eANI_DONOT_USE_SECONDARY_MODE:
-            break;
-    }
-
-
-    // We should only be changing primary and secondary channels on the fly
-    // if this is 11h enabled.
-    if (
-#if 0
-        pMac->lim.gLim11hEnable &&
-#endif
-        psessionEntry->currentOperChannel != newChannel)
+    // Store the new primary and secondary channel in session entries if different
+    if (psessionEntry->currentOperChannel != newChannel)
     {
         limLog(pMac, LOGW,
             FL("switch old chnl %d --> new chnl %d \n"),
             psessionEntry->currentOperChannel, newChannel);
-
-        #if 0
-
-        if (cfgSetInt(pMac, WNI_CFG_CURRENT_CHANNEL, newChannel) != eSIR_SUCCESS)
-            limLog(pMac, LOGP, FL("set CURRENT_CHANNEL at CFG fail.\n"));
-        #endif // TO SUPPORT BT-AMP
-
         psessionEntry->currentOperChannel = newChannel;
     }
+    if (psessionEntry->htSecondaryChannelOffset != subband)
+    {
+        limLog(pMac, LOGW,
+            FL("switch old sec chnl %d --> new sec chnl %d \n"),
+            psessionEntry->htSecondaryChannelOffset, subband);
+        psessionEntry->htSecondaryChannelOffset = subband;
+        if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
+        {
+            psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+        }
+        else
+        {
+            psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
+        }
+        psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
+    }
 
     return;
 }
@@ -3847,7 +3736,7 @@
     if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
         return bScanTriggered;
     
-    if( !pMac->lim.gLim11hEnable )
+    if( !psessionEntry->lim11hEnable )
     {
         tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
         tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
@@ -4035,7 +3924,7 @@
       break;
 
     case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
-      retVal = (tANI_U8) macHTCapabilityInfo.supportedChannelWidthSet;
+      retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
       break;
 
     case eHT_ADVANCED_CODING:
@@ -4083,11 +3972,11 @@
       break;
 
     case eHT_RECOMMENDED_TX_WIDTH_SET:
-      retVal = pMac->lim.gHTRecommendedTxWidthSet;
+      retVal = psessionEntry->htRecommendedTxWidthSet;
       break;
 
     case eHT_EXTENSION_CHANNEL_OFFSET:
-      retVal = pMac->lim.gHTSecondaryChannelOffset;
+      retVal = psessionEntry->htSecondaryChannelOffset;
       break;
 
     case eHT_OP_MODE:
@@ -4126,20 +4015,6 @@
   return retVal;
 }
 
-#if 0
-void limSetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId)
-{
-    palCopyMemory( pMac->hHdd, pMac->lim.gLimBssid, bssId, sizeof(tSirMacAddr));
-    return;
-}
-
-void limGetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId)
-{
-    palCopyMemory( pMac->hHdd, bssId, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
-    return;
-}
-
-#endif
 void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
 {
     palCopyMemory( pMac->hHdd, mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
@@ -4177,7 +4052,8 @@
         else
         {
             //normal protection config check
-            if(!pMac->lim.cfgProtection.fromlla)
+            if (( psessionEntry != NULL ) && (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
+                (!psessionEntry->cfgProtection.fromlla))
             {
                 // protection disabled.
                 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled\n"));)
@@ -4190,7 +4066,7 @@
         //If we are AP and HT capable, we need to set the HT OP mode
         //appropriately.
         if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
-              (true == psessionEntry->htCapabality))
+              (true == psessionEntry->htCapability))
         {
             if(overlap)
             {
@@ -4210,6 +4086,7 @@
                 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
                 {
                     pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
+                    psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
                     limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
                     limEnableHtOBSSProtection(pMac,  true, overlap, pBeaconParams,psessionEntry);         
                     
@@ -4238,7 +4115,7 @@
                 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
 
                 //We need to take care of HT OP mode iff we are HT AP.
-                if(psessionEntry->htCapabality)
+                if(psessionEntry->htCapability)
                 {
                    // no HT op mode change if any of the overlap protection enabled.
                     if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
@@ -4277,16 +4154,19 @@
 
                 {
                         pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
+                        psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
                         limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
                 }
                 else if(psessionEntry->gLimHt20Params.protectionEnabled)
                 {
                         pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
+                        psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
                         limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
                 }
                 else
                 {
                         pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
+                        psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
                         limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
                 }
             }
@@ -4369,7 +4249,7 @@
             {
                 psessionEntry->gLimOlbcParams.protectionEnabled = true;
                 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled\n"));)
-                if(true == psessionEntry->htCapabality)
+                if(true == psessionEntry->htCapability)
                 {
                     if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
                             (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
@@ -4388,7 +4268,7 @@
             {
                 psessionEntry->gLim11bParams.protectionEnabled = true;
                 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled\n"));)
-                if(true == psessionEntry->htCapabality)
+                if(true == psessionEntry->htCapability)
                 {
                     if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
                     {
@@ -4399,10 +4279,10 @@
                 }
             }
         }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
-                (true == psessionEntry->htCapabality))
+                (true == psessionEntry->htCapability))
 #else
             if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)|| (eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)) &&
-                    (true == psessionEntry->htCapabality))
+                    (true == psessionEntry->htCapability))
 #endif
             {
                 if(overlap)
@@ -4454,7 +4334,7 @@
                 psessionEntry->gLimOlbcParams.protectionEnabled = false;
 
                 //We need to take care of HT OP mode if we are HT AP.
-                if(psessionEntry->htCapabality)
+                if(psessionEntry->htCapability)
                 {
                     // no HT op mode change if any of the overlap protection enabled.
                     if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
@@ -4532,7 +4412,7 @@
                 psessionEntry->gLimOlbcParams.protectionEnabled = false;
 
                     //We need to take care of HT OP mode iff we are HT AP.
-                    if(psessionEntry->htCapabality)
+                    if(psessionEntry->htCapability)
                     {
                         // no HT op mode change if any of the overlap protection enabled.
                         if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
@@ -4617,7 +4497,7 @@
 limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
     tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
 {
-    if(!psessionEntry->htCapabality)
+    if(!psessionEntry->htCapability)
         return eSIR_SUCCESS; // protection from 11g is only for HT stations.
 
     //overlapping protection configuration check.
@@ -4917,7 +4797,7 @@
 {
 
 
-    if(!psessionEntry->htCapabality)
+    if(!psessionEntry->htCapability)
         return eSIR_SUCCESS; // this protection  is only for HT stations.
 
     //overlapping protection configuration check.
@@ -5009,7 +4889,7 @@
 limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
     tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
 {
-    if(!psessionEntry->htCapabality)
+    if(!psessionEntry->htCapability)
         return eSIR_SUCCESS; // this protection  is only for HT stations.
 
         //overlapping protection configuration check.
@@ -5237,7 +5117,7 @@
 limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
     tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
 {
-    if(!psessionEntry->htCapabality)
+    if(!psessionEntry->htCapability)
         return eSIR_SUCCESS; // this protection  is only for HT stations.
 
         //overlapping protection configuration check.
@@ -5320,7 +5200,7 @@
 limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
     tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
 {
-    if(!psessionEntry->htCapabality)
+    if(!psessionEntry->htCapability)
         return eSIR_SUCCESS; // this protection  is only for HT stations.
 
         //overlapping protection configuration check.
@@ -5405,7 +5285,7 @@
 limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
     tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
 {
-    if(!psessionEntry->htCapabality)
+    if(!psessionEntry->htCapability)
         return eSIR_SUCCESS; // this protection  is only for HT stations.
 
 
@@ -5597,7 +5477,7 @@
         if(VOS_IS_STATUS_SUCCESS(vosStatus))
         {
             mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
-            MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, 0, mHdr->fc.subType);)
+            MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, NO_SESSION, mHdr->fc.subType);)
 
         }   
     }
@@ -5635,7 +5515,7 @@
                                   tANI_U8          bssIdx,
                                   tpPESession      psessionEntry)
 {
-    tSirMacHTSecondaryChannelOffset secondaryChnlOffset = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
+    ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
 #if !defined WLAN_FEATURE_VOWIFI  
     tANI_U32 localPwrConstraint;
 #endif
@@ -5655,20 +5535,13 @@
     }
 #endif
 
-    if ( pMac->lim.gHTSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
-         pMac->lim.gHTRecommendedTxWidthSet  != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
+    if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
+         psessionEntry->htRecommendedTxWidthSet  != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
     {
-        pMac->lim.gHTSecondaryChannelOffset = ( tSirMacHTSecondaryChannelOffset ) pHTInfo->secondaryChannelOffset;
-        pMac->lim.gHTRecommendedTxWidthSet  = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
-        //Also update the Proprietary(Titan) CB mode settings, as this setting is used during 
-        //background scanning to set the original channel and CB mode as part of finish scan.
-        setupCBState( pMac,  limGetAniCBState(pMac->lim.gHTSecondaryChannelOffset));
-
-        // If the Channel Width is 20Mhz, set the channel offset to
-        // NONE.  If the Channel Width is 40Mhz, set the channel offset
-        // to what ever is present in beacon.
-        if ( eHT_CHANNEL_WIDTH_40MHZ == pMac->lim.gHTRecommendedTxWidthSet )
-            secondaryChnlOffset = (tSirMacHTSecondaryChannelOffset)pHTInfo->secondaryChannelOffset;
+        psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
+        psessionEntry->htRecommendedTxWidthSet  = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
+        if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
+            secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
 
         // Notify HAL
         limLog( pMac, LOGW,  FL( "Channel Information in HT IE change"
@@ -5676,7 +5549,7 @@
         limLog( pMac, LOGW,  FL( "Primary Channel: %d, Secondary Chan"
                                  "nel Offset: %d, Channel Width: %d\n" ),
                 pHTInfo->primaryChannel, secondaryChnlOffset,
-                pMac->lim.gHTRecommendedTxWidthSet );
+                psessionEntry->htRecommendedTxWidthSet );
 
 #if defined WLAN_FEATURE_VOWIFI  
         limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
@@ -5750,15 +5623,15 @@
 void limUpdateStaRunTimeHTInfo( tpAniSirGlobal  pMac,
                                 tDot11fIEHTInfo *pHTInfo , tpPESession psessionEntry)
 {
-    if ( pMac->lim.gHTSecondaryChannelOffset != ( tANI_U8)pHTInfo->secondaryChannelOffset)
+    if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8)pHTInfo->secondaryChannelOffset)
     {
-        pMac->lim.gHTSecondaryChannelOffset = ( tSirMacHTSecondaryChannelOffset )pHTInfo->secondaryChannelOffset;
+        psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState )pHTInfo->secondaryChannelOffset;
         // Send change notification to HAL
     }
 
-    if ( pMac->lim.gHTRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
+    if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
     {
-        pMac->lim.gHTRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
+        psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
         // Send change notification to HAL
     }
 
@@ -6000,7 +5873,7 @@
            psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
       {
         //send message to HAL to delete TS
-        if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, pDeltsReq->req))
+        if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, pDeltsReq->req, psessionEntry->peSessionId))
         {
           limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request\n"),
                            tsinfo->traffic.userPrio);
@@ -6035,7 +5908,7 @@
     msg.bodyptr = pHalCB;
     msg.bodyval = 0;
     
-    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
     if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
     {
         palFreeMemory(pMac->hHdd, pHalCB);
@@ -6084,7 +5957,7 @@
     }
        
     //if we are not HT capable we don't need to handle BA timeout indication from HAL.
-    if( (baCandidateCnt  > pMac->lim.maxStation) || !psessionEntry->htCapabality )
+    if( (baCandidateCnt  > pMac->lim.maxStation) || !psessionEntry->htCapability )
     {
         palFreeMemory(pMac->hHdd, limMsg->bodyptr);
         return;
@@ -6194,6 +6067,7 @@
 if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
     {
          limLog(pMac, LOGE,FL("session does not exist for given BssId\n"));
+         palFreeMemory(pMac->hHdd, (void *)(limMsg->bodyptr));
          return;
     }
 
@@ -6664,7 +6538,7 @@
   //defer any other message until we get response back.
   SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
 
-  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -6757,7 +6631,7 @@
   limLog( pMac, LOGW,
       FL( "Sending SIR_HAL_DELBA_IND..." ));
 
-  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -6837,7 +6711,7 @@
 
     limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
 
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if (eSIR_SUCCESS != retCode)
     {
@@ -7089,7 +6963,7 @@
     msgQ.reserved = 0;
     msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
 
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
     {
         palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
@@ -7139,7 +7013,7 @@
         return retCode;
     
     /* Channel switch should be ready for the next time */
-    pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
+    psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
 
     /* Restore the frame transmission, all the time. */
     limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
@@ -7161,7 +7035,7 @@
 
         if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
         {
-            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
+            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
             if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
             {
                 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
@@ -7174,7 +7048,7 @@
     /* Enable heartbeat timer */
     if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
         if(limActivateHearBeatTimer(pMac) != TX_SUCCESS)
         {
             limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
@@ -7193,7 +7067,7 @@
 \param pMac
 \return NONE
 ---------------------------------------------*/
-tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac)
+tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
 {
 
     tSirRetStatus retCode = eSIR_SUCCESS;
@@ -7204,10 +7078,10 @@
              return retCode;
  
     /* Quiet should be ready for the next time */
-    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+    psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
 
     /* Restore the frame transmission, all the time. */
-    if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
+    if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
         limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
 
 
@@ -7225,7 +7099,7 @@
 
         if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
         {
-            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
+            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
             if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
             {
                 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
@@ -7238,7 +7112,7 @@
     /* Enable heartbeat timer */
     if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_HEART_BEAT_TIMER));
         if(limActivateHearBeatTimer(pMac) != TX_SUCCESS)
         {
             limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
@@ -7277,7 +7151,7 @@
         return;
      
     /* Flag to indicate 11h channel switch in progress */
-    pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
+    psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
 
     /* Disable, Stop background scan if enabled and running */
     limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
@@ -7539,6 +7413,7 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
     {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+        palFreeMemory(pMac, pAddStaParams);
         return;
     }
     if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
@@ -7734,6 +7609,7 @@
    {
       /// Buffer not available. Log error
       limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP\n"));
+      palFreeMemory( pMac->hHdd, (tANI_U8 *)pAddStaSelfParams);
       return;
    }
 
@@ -7750,7 +7626,7 @@
    mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
    mmhMsg.bodyptr = pRsp;
    mmhMsg.bodyval = 0;
-   MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
    limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 
 }
@@ -7769,6 +7645,7 @@
    {
       /// Buffer not available. Log error
       limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP\n"));
+      palFreeMemory( pMac->hHdd, (tANI_U8 *)pDelStaSelfParams);
       return;
    }
 
@@ -7785,7 +7662,7 @@
    mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
    mmhMsg.bodyptr = pRsp;
    mmhMsg.bodyval = 0;
-   MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
    limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 
 }
@@ -7982,19 +7859,20 @@
     return 0;
         
 }
-void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, tANI_U8 cbState)
+
+void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
 {
 
    pMac->lim.gResumeChannel = channel;
-   //TODO : Save Cb State also.
-
+   pMac->lim.gResumePhyCbState = phyCbState;
 }
+
 /*--------------------------------------------------------------------------
   
   \brief peGetResumeChannel() - Returns the  channel number for scanning, from a valid session.
 
-  This function itrates the session Table and returns the channel number from first valid session
-   if no sessions are valid/present  it returns zero
+  This function returns the channel to resume to during link resume. channel id of 0 means HAL will
+  resume to previous channel before link suspend
     
   \param pMac                   - pointer to global adapter context
   \return                           - channel to scan from valid session else zero.
@@ -8002,28 +7880,28 @@
   \sa
   
   --------------------------------------------------------------------------*/
-
-tANI_U8 peGetResumeChannel(tpAniSirGlobal pMac)
-
+void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
 {
 
     //Rationale - this could be the suspend/resume for assoc and it is essential that
     //the new BSS is active for some time. Other BSS was anyway suspended.
     //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
     //there will be trouble. But since it is sent on current channel, it will be missed by peer
-    //and hence shpuld be ok. Need to discuss this further
-    if( !IS_MCC_SUPPORTED )    
+    //and hence should be ok. Need to discuss this further
+    if( !limIsInMCC(pMac) )    
     {
         //Get current active session channel
-        return peGetActiveSessionChannel(pMac);
+        peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
     }
     else
     {
-        return pMac->lim.gResumeChannel;
+        *resumeChannel = pMac->lim.gResumeChannel;
+        *resumePhyCbState = pMac->lim.gResumePhyCbState;
     }
-
+    return;
 }
 
+
 #endif
 
 tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
diff --git a/CORE/MAC/src/pe/lim/limUtils.h b/CORE/MAC/src/pe/lim/limUtils.h
index 1aa6355..c8dd8bd 100644
--- a/CORE/MAC/src/pe/lim/limUtils.h
+++ b/CORE/MAC/src/pe/lim/limUtils.h
@@ -193,10 +193,8 @@
 
 void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId);
 void limUpdateQuietIEFromBeacon(tpAniSirGlobal, tDot11fIEQuiet *, tpPESession);
-void limGetHtCbAdminState(tpAniSirGlobal pMac, tDot11fIEHTCaps htCaps, tANI_U8 * titanHtCaps);
-void limGetHtCbOpState(tpAniSirGlobal pMac, tDot11fIEHTInfo htInfo, tANI_U8 * titanHtCaps);
 void limSwitchPrimaryChannel(tpAniSirGlobal, tANI_U8,tpPESession);
-void limSwitchPrimarySecondaryChannel(tpAniSirGlobal, tANI_U8, tAniCBSecondaryMode);
+void limSwitchPrimarySecondaryChannel(tpAniSirGlobal, tpPESession, tANI_U8, ePhyChanBondState);
 tAniBool limTriggerBackgroundScanDuringQuietBss(tpAniSirGlobal);
 void limUpdateStaRunTimeHTSwtichChnlParams(tpAniSirGlobal pMac, tDot11fIEHTInfo *pRcvdHTInfo, tANI_U8 bssIdx);
 void limUpdateStaRunTimeHTCapability(tpAniSirGlobal pMac, tDot11fIEHTCaps *pHTCaps);
@@ -206,7 +204,7 @@
 tAniBool limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel);
 void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode);
 tSirRetStatus limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry);
-tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac);
+tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry);
 
 void limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry);
 void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status, 
@@ -464,13 +462,13 @@
 void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode);
 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
 
-void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, tANI_U8 cbState);
+void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState cbState);
 /*--------------------------------------------------------------------------
   
   \brief peGetResumeChannel() - Returns the  channel number for scanning, from a valid session.
 
-  This function itrates the session Table and returns the channel number from first valid session
-   if no sessions are valid it returns 0
+  This function returns the channel to resume to during link resume. channel id of 0 means HAL will
+  resume to previous channel before link suspend
     
   \param pMac                   - pointer to global adapter context
   \return                            - channel to scan from valid session else zero.
@@ -478,7 +476,6 @@
   \sa
   
   --------------------------------------------------------------------------*/
-tANI_U8 peGetResumeChannel(tpAniSirGlobal pMac);
-
+void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState);
 
 #endif /* __LIM_UTILS_H */
diff --git a/CORE/MAC/src/pe/pmm/pmmApi.c b/CORE/MAC/src/pe/pmm/pmmApi.c
index 2070549..79a4d12 100644
--- a/CORE/MAC/src/pe/pmm/pmmApi.c
+++ b/CORE/MAC/src/pe/pmm/pmmApi.c
@@ -246,7 +246,7 @@
             /* Disable heartbeat timer as well */
             if(pMac->lim.limTimers.gLimHeartBeatTimer.pMac)
             {
-                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
+                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_HEART_BEAT_TIMER));
                 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
             }
         }
@@ -428,8 +428,8 @@
     if ( ((pMac->pmm.gPmmState != ePMM_STATE_READY) &&
          (pMac->pmm.gPmmState != ePMM_STATE_BMPS_WAKEUP)) ||
          limIsSystemInScanState(pMac) ||
-         (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) ||
-         (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
+         limIsChanSwitchRunning(pMac) ||
+         limIsInQuietDuration(pMac) )
     {
         PELOGE(pmmLog(pMac, LOGE, 
             FL("pmmBmps: BMPS Request received in invalid state PMM=%d, SME=%d, rejecting the initpwrsave request\n"), 
@@ -524,6 +524,7 @@
     tSirRetStatus  retStatus = eSIR_SUCCESS;
     tpExitBmpsParams  pExitBmpsParams;
     tSirMsgQ msgQ;
+    tpPESession psessionEntry;
     tANI_U8  currentOperatingChannel = limGetCurrentOperatingChannel(pMac);
 
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pExitBmpsParams, sizeof(*pExitBmpsParams)) )
@@ -533,6 +534,12 @@
         return retStatus;
     }
 
+    if((psessionEntry = peGetValidPowerSaveSession(pMac)) == NULL )
+    {
+        retStatus = eSIR_FAILURE;
+        return retStatus;
+    }
+
     palZeroMemory( pMac->hHdd, (tANI_U8 *)pExitBmpsParams, sizeof(*pExitBmpsParams));
     msgQ.type = WDA_EXIT_BMPS_REQ;
     msgQ.reserved = 0;
@@ -550,11 +557,13 @@
              limIsconnectedOnDFSChannel(currentOperatingChannel))))
         pExitBmpsParams->sendDataNull = 1;
 
+    pExitBmpsParams->bssIdx = psessionEntry->bssIdx;
+   
     /* we need to defer any incoming messages until we
      * get a WDA_EXIT_BMPS_RSP from HAL.
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     retStatus = wdaPostCtrlMsg( pMac, &msgQ);
     if( eSIR_SUCCESS != retStatus )
     {
@@ -679,7 +688,7 @@
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
 
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pBmpsParams);
@@ -724,7 +733,7 @@
     if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE  )
     {
         pmmLog(pMac, LOGE,
-            FL("pmmCfg: Power Save Configuration received in invalid state %d"),
+            FL("pmmCfg: Power Save Configuration received in invalid global sme state %d"),
             pMac->lim.gLimSmeState);
         retCode = eSIR_SME_INVALID_STATE;
         goto returnFailure;
@@ -785,7 +794,7 @@
     msgQ.bodyval = 0;
 
     PELOG1(pmmLog( pMac, LOG1, FL( "pmmBmps: Sending WDA_PWR_SAVE_CFG to HAL"));)
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         pmmLog( pMac, LOGP,
@@ -902,7 +911,15 @@
     pMac->sys.gSysEnableScanMode = true;
 
     // send response to PMC
-    limSendSmeRsp(pMac, eWNI_PMC_EXIT_BMPS_RSP, retStatus, 0, 0);
+   if(IS_SLM_SESSIONIZED )
+   {
+       limSendSmeRsp(pMac, eWNI_PMC_EXIT_BMPS_RSP, retStatus, 
+                  psessionEntry->smeSessionId, psessionEntry->transactionId);
+   }
+   else
+   {
+       limSendSmeRsp(pMac, eWNI_PMC_EXIT_BMPS_RSP, retStatus, 0, 0);
+   }
 
     if ( pMac->pmm.gPmmExitBmpsReasonCode == eSME_MISSED_BEACON_IND_RCVD)
     {
@@ -1493,11 +1510,11 @@
          ((pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE) &&
           (pMac->lim.gLimSmeState != eLIM_SME_JOIN_FAILURE_STATE)) ||
          (pMac->lim.gLimMlmState != eLIM_MLM_IDLE_STATE) ||
-         (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) ||
-         (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
+         limIsChanSwitchRunning (pMac) ||
+         limIsInQuietDuration (pMac) )
     {
         PELOGE(pmmLog(pMac, LOGE, 
-              FL("pmmImps: PMM State = %d, MLM State = %d, SME State = %d, rejecting the sleep mode request\n"),
+              FL("pmmImps: PMM State = %d, Global MLM State = %d, Global SME State = %d, rejecting the sleep mode request\n"),
               pMac->pmm.gPmmState, pMac->lim.gLimMlmState, pMac->lim.gLimSmeState);)
 
         resultCode = eSIR_SME_INVALID_PMM_STATE;
@@ -1783,7 +1800,7 @@
          limIsSystemInScanState(pMac) )
     {
         PELOGE(pmmLog(pMac, LOGE,
-            FL("pmmUapsd: PMM State = %d, MLM State = %d, SME State = %d, rejecting the sleep mode request\n"),
+            FL("pmmUapsd: PMM State = %d, Global MLM State = %d, Global SME State = %d, rejecting the sleep mode request\n"),
             pMac->pmm.gPmmState, pMac->lim.gLimMlmState, pMac->lim.gLimSmeState);)
 
         resultCode = eSIR_SME_INVALID_PMM_STATE;
@@ -1829,11 +1846,16 @@
     tpUapsdParams    pUapsdRspMsg;
     tSirResultCodes  retStatus = eSIR_SME_SUCCESS;
 
+    tANI_U8 PowersavesessionId;
+    tpPESession psessionEntry;
+
     /* we need to process all the deferred messages enqueued since
      * the initiating the SIR_HAL_ENTER_UAPSD_REQ.
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
 
+    /* Copy the power save sessionId to the local variable */
+    PowersavesessionId = pMac->pmm.sessionId;
 
     if (NULL == limMsg->bodyptr)
     {
@@ -1843,6 +1865,12 @@
 
     pUapsdRspMsg = (tpUapsdParams)(limMsg->bodyptr);
 
+    if((psessionEntry = peFindSessionBySessionId(pMac,PowersavesessionId))==NULL)
+    {
+        limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+        return;
+    }
+
     if(pMac->pmm.gPmmState != ePMM_STATE_UAPSD_WT_SLEEP_RSP)
     {
         PELOGE(pmmLog(pMac, LOGE,
@@ -1866,7 +1894,16 @@
         retStatus = eSIR_SME_UAPSD_REQ_FAILED;
     }
 
-    limSendSmeRsp(pMac, eWNI_PMC_ENTER_UAPSD_RSP, retStatus, 0, 0);    
+    if(IS_SLM_SESSIONIZED )
+    {
+        limSendSmeRsp(pMac, eWNI_PMC_ENTER_UAPSD_RSP, retStatus, 
+                        psessionEntry->smeSessionId, psessionEntry->transactionId);
+    }
+    else
+    {
+        limSendSmeRsp(pMac, eWNI_PMC_ENTER_UAPSD_RSP, retStatus, 0, 0);
+    }
+
     return;
 }
 
@@ -1948,6 +1985,8 @@
 void pmmExitUapsdResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus)
 {
     tSirResultCodes resultCode = eSIR_SME_SUCCESS;
+    tANI_U8 PowersavesessionId;
+    tpPESession psessionEntry;
 
     /* we need to process all the deferred messages enqueued since
      * the initiating the SIR_HAL_EXIT_UAPSD_REQ.
@@ -1963,6 +2002,13 @@
         return;
     }
 
+    PowersavesessionId = pMac->pmm.sessionId;
+    if((psessionEntry = peFindSessionBySessionId(pMac,PowersavesessionId))==NULL)
+    {
+        limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
+        return;
+    }
+
     switch(rspStatus)
     {
         case eHAL_STATUS_SUCCESS:
@@ -1978,7 +2024,16 @@
     }
 
     pMac->pmm.gPmmState = ePMM_STATE_BMPS_SLEEP;
-    limSendSmeRsp(pMac, eWNI_PMC_EXIT_UAPSD_RSP, resultCode, 0, 0);
+
+    if(IS_SLM_SESSIONIZED)
+    {
+        limSendSmeRsp(pMac, eWNI_PMC_EXIT_UAPSD_RSP, resultCode, psessionEntry->smeSessionId,
+                      psessionEntry->transactionId);
+    }
+    else
+    {
+        limSendSmeRsp(pMac, eWNI_PMC_EXIT_UAPSD_RSP, resultCode, 0, 0);
+    }
     return;
 }
 
@@ -2424,7 +2479,7 @@
      * WDA_ENTER_IMPS_REQ or WDA_EXIT_IMPS_RSP from HAL.
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     retStatus = wdaPostCtrlMsg(pMac, &msgQ);
     if ( eSIR_SUCCESS != retStatus )
     {
@@ -2456,6 +2511,7 @@
     tANI_U8  uapsdDeliveryMask = 0;
     tANI_U8  uapsdTriggerMask = 0;
     tSirMsgQ msgQ;
+    tpPESession pSessionEntry;
 
     if (SIR_PM_SLEEP_MODE == mode)
     {
@@ -2465,6 +2521,13 @@
             retStatus = eSIR_MEM_ALLOC_FAILED;
             return retStatus;
         }
+
+        if((pSessionEntry = peGetValidPowerSaveSession(pMac)) == NULL )
+        {
+            PELOGW(pmmLog(pMac, LOGW, FL("pmmUapsd :palAllocateMemory() failed\n"));)
+            retStatus = eSIR_FAILURE;
+            return retStatus;
+        }
         palZeroMemory( pMac->hHdd, (tANI_U8 *)pUapsdParams, sizeof(tUapsdParams));
         msgQ.type = WDA_ENTER_UAPSD_REQ;
         msgQ.bodyptr = pUapsdParams;
@@ -2480,6 +2543,8 @@
         pUapsdParams->beTriggerEnabled = LIM_UAPSD_GET(ACBE, uapsdTriggerMask);
         pUapsdParams->viTriggerEnabled = LIM_UAPSD_GET(ACVI, uapsdTriggerMask);
         pUapsdParams->voTriggerEnabled = LIM_UAPSD_GET(ACVO, uapsdTriggerMask);
+        pUapsdParams->bssIdx = pSessionEntry->bssIdx;
+
         PELOGE(pmmLog(pMac, LOGE, 
                       FL("UAPSD Mask:  static = 0x%x, DeliveryEnabled = 0x%x, TriggerEnabled = 0x%x \n"),
             pMac->lim.gUapsdPerAcBitmask,
@@ -2514,7 +2579,7 @@
 
     msgQ.reserved = 0;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
     retStatus = wdaPostCtrlMsg(pMac, &msgQ);
     if ( eSIR_SUCCESS != retStatus )
     {
diff --git a/CORE/MAC/src/pe/rrm/rrmApi.c b/CORE/MAC/src/pe/rrm/rrmApi.c
index 6363f17..5ac52ba 100644
--- a/CORE/MAC/src/pe/rrm/rrmApi.c
+++ b/CORE/MAC/src/pe/rrm/rrmApi.c
@@ -163,7 +163,7 @@
 
    PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_SET_MAX_TX_POWER_REQ to HAL"));)
 
-      MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+      MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
    if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
    {
       limLog( pMac, LOGP, FL("Posting WDA_SET_MAX_TX_POWER_REQ to HAL failed, reason=%X"), retCode );
@@ -380,7 +380,7 @@
    //Send request to SME.
    mmhMsg.type    = pSmeNeighborRpt->messageType;
    mmhMsg.bodyptr = pSmeNeighborRpt;
-   MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, mmhMsg.type));
    status = limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
    return status;
@@ -607,7 +607,7 @@
    //Send request to SME.
    mmhMsg.type    = eWNI_SME_BEACON_REPORT_REQ_IND;
    mmhMsg.bodyptr = pSmeBcnReportReq;
-   MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, mmhMsg.type));
    return limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 }
 
diff --git a/CORE/MAC/src/pe/sch/schApi.c b/CORE/MAC/src/pe/sch/schApi.c
index 8d90e5e..fa85478 100644
--- a/CORE/MAC/src/pe/sch/schApi.c
+++ b/CORE/MAC/src/pe/sch/schApi.c
@@ -341,7 +341,7 @@
     psessionEntry->bcnLen = size;
   }
 
-  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
   {
     schLog( pMac, LOGE,
diff --git a/CORE/MAC/src/pe/sch/schBeaconGen.c b/CORE/MAC/src/pe/sch/schBeaconGen.c
index 23b85c3..0921d00 100644
--- a/CORE/MAC/src/pe/sch/schBeaconGen.c
+++ b/CORE/MAC/src/pe/sch/schBeaconGen.c
@@ -303,14 +303,14 @@
         PopulateDot11fEDCAParamSet( pMac, &bcn2.EDCAParamSet, psessionEntry);
     }
 
-    if(pMac->lim.gLim11hEnable)
+    if(psessionEntry->lim11hEnable)
     {
       PopulateDot11fPowerConstraints( pMac, &bcn2.PowerConstraints );
       PopulateDot11fTPCReport( pMac, &bcn2.TPCReport, psessionEntry);
     }
 
 #ifdef ANI_PRODUCT_TYPE_AP
-    if( pMac->lim.gLim11hEnable && (eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState))
+    if( psessionEntry->lim11hEnable && (eLIM_QUIET_RUNNING == psessionEntry->gLimSpecMgmt.quietState))
     {
       PopulateDot11fQuiet( pMac, &bcn2.Quiet );
     }
@@ -321,28 +321,38 @@
      * populate the 802.11h channel switch IE in its Beacons and Probe
      * Responses.
      */
-    if ( (pMac->lim.gLim11hEnable) &&
-         (pMac->lim.gLimChannelSwitch.switchCount != 0) &&
-         (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING))
+    if ( (psessionEntry->lim11hEnable) &&
+         (psessionEntry->gLimChannelSwitch.switchCount != 0) &&
+         (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING))
 
     {
-      PopulateDot11fChanSwitchAnn( pMac, &bcn2.ChanSwitchAnn );
-      PopulateDot11fExtChanSwitchAnn(pMac, &bcn2.ExtChanSwitchAnn);
+      PopulateDot11fChanSwitchAnn( pMac, &bcn2.ChanSwitchAnn, psessionEntry );
+      PopulateDot11fExtChanSwitchAnn(pMac, &bcn2.ExtChanSwitchAnn, psessionEntry );
     }
 #endif
 
     if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B)
         PopulateDot11fERPInfo( pMac, &bcn2.ERPInfo, psessionEntry );
 
-    if(psessionEntry->htCapabality)
+    if(psessionEntry->htCapability)
     {
-        PopulateDot11fHTCaps( pMac, &bcn2.HTCaps );
+        PopulateDot11fHTCaps( pMac, psessionEntry, &bcn2.HTCaps );
 #ifdef WLAN_SOFTAP_FEATURE
         PopulateDot11fHTInfo( pMac, &bcn2.HTInfo, psessionEntry );
 #else
         PopulateDot11fHTInfo( pMac, &bcn2.HTInfo );
 #endif
     }
+#ifdef WLAN_FEATURE_11AC
+    if(psessionEntry->vhtCapability)
+    {        
+        limLog( pMac, LOGW, FL("Populate VHT IEs in Beacon\n"));
+        PopulateDot11fVHTCaps( pMac, &bcn2.VHTCaps );
+        PopulateDot11fVHTOperation( pMac, &bcn2.VHTOperation);
+        // we do not support multi users yet
+        //PopulateDot11fVHTExtBssLoad( pMac, &bcn2.VHTExtBssLoad);
+    }
+#endif
 
     PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
                                 &bcn2.ExtSuppRates, psessionEntry );
@@ -628,6 +638,30 @@
                             sizeof(beacon2->HTInfo));
     }
 
+#ifdef WLAN_FEATURE_11AC
+    if(beacon2->VHTCaps.present)
+    {
+        SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_VHT_CAPABILITIES_EID);
+        palCopyMemory(pMac->hHdd,(void *)&prb_rsp->VHTCaps,
+                            (void *)&beacon2->VHTCaps,
+                            sizeof(beacon2->VHTCaps));
+    }
+    if(beacon2->VHTOperation.present)
+    {
+        SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_VHT_OPERATION_EID);
+        palCopyMemory(pMac->hHdd,(void *)&prb_rsp->VHTOperation,
+                            (void *)&beacon2->VHTOperation,
+                            sizeof(beacon2->VHTOperation));
+    }
+    if(beacon2->VHTExtBssLoad.present)
+    {
+        SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_VHT_EXT_BSS_LOAD_EID);
+        palCopyMemory(pMac->hHdd,(void *)&prb_rsp->VHTExtBssLoad,
+                            (void *)&beacon2->VHTExtBssLoad,
+                            sizeof(beacon2->VHTExtBssLoad));
+    }
+#endif
+
     //WMM IE
     if(beacon2->WMMParams.present)
     {
@@ -957,12 +991,12 @@
                     limSwitchPrimaryChannel(pMac, pMac->lim.gLimChannelSwitch.primaryChannel);
                     break;
                 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
-                    limSwitchPrimarySecondaryChannel(pMac,
+                    limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
                                              psessionEntry->currentOperChannel,
                                              pMac->lim.gLimChannelSwitch.secondarySubBand);
                     break;
                 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
-                    limSwitchPrimarySecondaryChannel(pMac,
+                    limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
                                              pMac->lim.gLimChannelSwitch.primaryChannel,
                                              pMac->lim.gLimChannelSwitch.secondarySubBand);
                     break;
diff --git a/CORE/MAC/src/pe/sch/schBeaconProcess.c b/CORE/MAC/src/pe/sch/schBeaconProcess.c
index abcfd62..1157847 100644
--- a/CORE/MAC/src/pe/sch/schBeaconProcess.c
+++ b/CORE/MAC/src/pe/sch/schBeaconProcess.c
@@ -85,7 +85,7 @@
 
     if(SIR_BAND_5_GHZ == rfBand)
     {
-        if (psessionEntry->htCapabality)
+        if (psessionEntry->htCapability)
         {
             if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
             {
@@ -122,7 +122,7 @@
     {
         //We are 11G AP.
         if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
-              (false == psessionEntry->htCapabality))
+              (false == psessionEntry->htCapability))
         {
             if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)        
             {
@@ -149,7 +149,7 @@
             }
         }        
         // handling the case when HT AP has overlapping legacy BSS.
-        else if(psessionEntry->htCapabality)
+        else if(psessionEntry->htCapability)
         {             
             if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
             {
@@ -396,8 +396,8 @@
 
 
 
-        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, pBeacon->timeStamp[0]);)
-        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, pBeacon->timeStamp[1]);)
+        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[0]);)
+        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[1]);)
 
         /* Read beacon interval session Entry */
         bi = psessionEntry->beaconParams.beaconInterval;
@@ -472,7 +472,7 @@
             sendProbeReq = TRUE;
     }
 
-    if ( pMac->lim.htCapability && pBeacon->HTInfo.present )
+    if ( psessionEntry->htCapability && pBeacon->HTInfo.present )
     {
         limUpdateStaRunTimeHTSwitchChnlParams( pMac, &pBeacon->HTInfo, bssIdx,psessionEntry);
     }
@@ -485,8 +485,8 @@
         {
             limUpdateQuietIEFromBeacon(pMac, &(pBeacon->quietIE), psessionEntry);
         }
-        else if ((pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
-             (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
+        else if ((psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
+             (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
         {
             PELOG1(limLog(pMac, LOG1, FL("Received a beacon without Quiet IE\n"));)
             limCancelDot11hQuiet(pMac, psessionEntry);
@@ -498,7 +498,7 @@
         {
             limUpdateChannelSwitch(pMac, pBeacon, psessionEntry);
         }
-        else if (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+        else if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
         {
             limCancelDot11hChannelSwitch(pMac, psessionEntry);
         }   
@@ -520,7 +520,7 @@
              {
                 limLog( pMac, LOG1, "RegMax = %d, lpc = %d, MaxTx = %d", regMax, localConstraint, maxTxPower );
                 limLog( pMac, LOG1, "Local power constraint change..updating new maxTx power to HAL");
-                if( limSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eHAL_STATUS_SUCCESS )
+                if( limSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
                    psessionEntry->maxTxPower = maxTxPower;
              }
            }
@@ -569,9 +569,6 @@
             psessionEntry->bssId, psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
             psessionEntry->dot11mode, 0, NULL);
 
-   PELOG2(schLog(pMac, LOG2, "Received Beacon's SeqNum=%d\n",
-           (pMh->seqControl.seqNumHi << 4) | (pMh->seqControl.seqNumLo));)
-
     if(beaconParams.paramChangeBitmap)
     {
         PELOGW(schLog(pMac, LOGW, FL("Beacon for session[%d] got changed. \n"), psessionEntry->peSessionId);)