prima: WLAN Driver Release 3.2.0.9
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
index 526218c..01e53cc 100644
--- a/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -99,7 +99,7 @@
 #define BEACON_FRAME_IES_OFFSET 12
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
-extern void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set);
+extern void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set, v_U8_t sessionId);
 #endif
 
 void hdd_ResetCountryCodeAfterDisAssoc(hdd_adapter_t *pAdapter);
@@ -655,7 +655,8 @@
     netif_tx_disable(dev);
     netif_carrier_off(dev);
     
-    hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected );
+    INIT_COMPLETION(pAdapter->disconnect_comp_var);
+    hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting );
     /* If only STA mode is on */
     if((pHddCtx->concurrency_mode <= 1) && (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1))
     {
@@ -679,7 +680,13 @@
             /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */
             if( eCSR_ROAM_LOSTLINK == roamStatus )
             {
-                cfg80211_disconnected(dev, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, NULL, 0, GFP_KERNEL);
+                /* TODO: Need to pass proper reason code
+                   currently we are passing only one reason code.
+                   Currently we are passing WLAN_REASON_DISASSOC_STA_HAS_LEFT
+                   rather than WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY
+                   to avoid the supplicant fast reconnect */
+
+                cfg80211_disconnected(dev, WLAN_REASON_DISASSOC_STA_HAS_LEFT, NULL, 0, GFP_KERNEL);
             }
             else
             {
@@ -689,7 +696,11 @@
             //If the Device Mode is Station
             // and the P2P Client is Connected
             //Enable BMPS
-            if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
+
+            // In case of JB, as Change-Iface may or maynot be called for p2p0
+            // Enable BMPS/IMPS in case P2P_CLIENT disconnected   
+            if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
+                (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) &&
                 (vos_concurrent_sessions_running()))
             {
                //Enable BMPS only of other Session is P2P Client
@@ -704,8 +715,7 @@
                    {
                        //Only P2P Client is there Enable Bmps back
                        if((0 == pHddCtx->no_of_sessions[VOS_STA_SAP_MODE]) &&
-                          (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE]) &&
-                          (1 == pHddCtx->no_of_sessions[VOS_P2P_CLIENT_MODE]))
+                          (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE]))
                        {
                            hdd_enable_bmps_imps(pHddCtx);
                        }
@@ -1130,7 +1140,11 @@
         //If the Device Mode is Station
         // and the P2P Client is Connected
         //Enable BMPS
-        if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
+
+        // In case of JB, as Change-Iface may or maynot be called for p2p0
+        // Enable BMPS/IMPS in case P2P_CLIENT disconnected   
+        if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
+            (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) &&
             (vos_concurrent_sessions_running()))
         {
            //Enable BMPS only of other Session is P2P Client
@@ -1145,8 +1159,7 @@
                {
                    //Only P2P Client is there Enable Bmps back
                    if((0 == pHddCtx->no_of_sessions[VOS_STA_SAP_MODE]) &&
-                      (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE]) &&
-                      (1 == pHddCtx->no_of_sessions[VOS_P2P_CLIENT_MODE]))
+                      (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE]))
                    {
                        hdd_enable_bmps_imps(pHddCtx);
                    }
@@ -1156,18 +1169,31 @@
 
 #ifdef CONFIG_CFG80211
         /* inform association failure event to nl80211 */
-        cfg80211_connect_result(dev, pWextState->req_bssId,
+        if(eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult)
+        {
+           cfg80211_connect_result(dev, pWextState->req_bssId,
+                NULL, 0, NULL, 0,
+                WLAN_STATUS_ASSOC_DENIED_UNSPEC, 
+                GFP_KERNEL);
+        }
+        else
+        {
+           cfg80211_connect_result(dev, pWextState->req_bssId,
                 NULL, 0, NULL, 0,
                 WLAN_STATUS_UNSPECIFIED_FAILURE, 
                 GFP_KERNEL);
+        }
 #endif 
 
         netif_tx_disable(dev);
         netif_carrier_off(dev);
-
-        /* Association failed; Reset the country code information
-         * so that it re-initialize the valid channel list*/
-        hdd_ResetCountryCodeAfterDisAssoc(pAdapter);
+        
+        if (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode)
+        {
+            /* Association failed; Reset the country code information
+             * so that it re-initialize the valid channel list*/
+            hdd_ResetCountryCodeAfterDisAssoc(pAdapter);
+        }
     }
 
     return eHAL_STATUS_SUCCESS;
@@ -1634,14 +1660,17 @@
                     {
                         /*Filter applied during suspend mode*/
                         /*Clear it here*/
-                        wlan_hdd_set_mc_addr_list(pHddCtx, FALSE);
+                        wlan_hdd_set_mc_addr_list(pHddCtx, FALSE, pAdapter->sessionId);
                     }
                 }
 #endif
-                /* Disconnected from current AP. Reset the country code information
-                 * so that it re-initialize the valid channel list*/
-                hdd_ResetCountryCodeAfterDisAssoc(pAdapter);
 
+                if (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode)
+                {
+                    /* Disconnected from current AP. Reset the country code information
+                     * so that it re-initialize the valid channel list*/
+                    hdd_ResetCountryCodeAfterDisAssoc(pAdapter);
+                }
             }
             break;
         case eCSR_ROAM_IBSS_LEAVE:
diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c
index 83e3788..9eea30f 100644
--- a/CORE/HDD/src/wlan_hdd_cfg.c
+++ b/CORE/HDD/src/wlan_hdd_cfg.c
@@ -1472,6 +1472,50 @@
               CFG_MC_ADDR_LIST_ENABLE_MIN,
               CFG_MC_ADDR_LIST_ENABLE_MAX ),
 
+#ifdef WLAN_FEATURE_11AC              
+REG_VARIABLE( CFG_VHT_CHANNEL_WIDTH, WLAN_PARAM_Integer,
+              hdd_config_t, vhtChannelWidth, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+              CFG_VHT_CHANNEL_WIDTH_DEFAULT, 
+              CFG_VHT_CHANNEL_WIDTH_MIN, 
+              CFG_VHT_CHANNEL_WIDTH_MAX),
+
+REG_VARIABLE( CFG_VHT_ENABLE_RX_MCS_8_9, WLAN_PARAM_Integer,
+              hdd_config_t, vhtRxMCS, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+              CFG_VHT_ENABLE_RX_MCS_8_9_DEFAULT, 
+              CFG_VHT_ENABLE_RX_MCS_8_9_MIN, 
+              CFG_VHT_ENABLE_RX_MCS_8_9_MAX),
+
+REG_VARIABLE( CFG_VHT_ENABLE_TX_MCS_8_9, WLAN_PARAM_Integer,
+              hdd_config_t, vhtTxMCS, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
+              CFG_VHT_ENABLE_TX_MCS_8_9_DEFAULT, 
+              CFG_VHT_ENABLE_TX_MCS_8_9_MIN, 
+              CFG_VHT_ENABLE_TX_MCS_8_9_MAX),
+#endif
+
+REG_VARIABLE( CFG_ENABLE_FIRST_SCAN_2G_ONLY_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, enableFirstScan2GOnly, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_ENABLE_FIRST_SCAN_2G_ONLY_DEFAULT, 
+              CFG_ENABLE_FIRST_SCAN_2G_ONLY_MIN, 
+              CFG_ENABLE_FIRST_SCAN_2G_ONLY_MAX ),
+
+REG_VARIABLE( CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, skipDfsChnlInP2pSearch, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_DEFAULT, 
+              CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_MIN, 
+              CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_MAX ),
+
+REG_VARIABLE( CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_NAME, WLAN_PARAM_Integer,
+              hdd_config_t, ignoreDynamicDtimInP2pMode, 
+              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
+              CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_DEFAULT, 
+              CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_MIN, 
+              CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_MAX ),
+
 };
 
 /*
@@ -1834,6 +1878,12 @@
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableDFSChnlScan] Value = [%u] ",pHddCtx->cfg_ini->enableDFSChnlScan);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gReportMaxLinkSpeed] Value = [%u] ",pHddCtx->cfg_ini->reportMaxLinkSpeed);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [thermalMitigationEnable] Value = [%u] ",pHddCtx->cfg_ini->thermalMitigationEnable);
+#ifdef WLAN_FEATURE_11AC
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gVhtChannelWidth] value = [%u]\n",pHddCtx->cfg_ini->vhtChannelWidth);
+#endif
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [enableFirstScan2GOnly] Value = [%u] ",pHddCtx->cfg_ini->enableFirstScan2GOnly);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [skipDfsChnlInP2pSearch] Value = [%u] ",pHddCtx->cfg_ini->skipDfsChnlInP2pSearch);
+  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [ignoreDynamicDtimInP2pMode] Value = [%u] ",pHddCtx->cfg_ini->ignoreDynamicDtimInP2pMode);
 }
 
 
@@ -2216,6 +2266,12 @@
          return eCSR_DOT11_MODE_11n_ONLY;
       case (eHDD_DOT11_MODE_11b_ONLY):
          return eCSR_DOT11_MODE_11b_ONLY;
+#ifdef WLAN_FEATURE_11AC
+      case (eHDD_DOT11_MODE_11ac_ONLY):
+         return eCSR_DOT11_MODE_11ac_ONLY;
+      case (eHDD_DOT11_MODE_11ac):
+         return eCSR_DOT11_MODE_11ac;
+#endif
       case (eHDD_DOT11_MODE_AUTO):
          return eCSR_DOT11_MODE_AUTO;
    }
@@ -2769,6 +2825,53 @@
         hddLog(LOGE, "Could not pass on WNI_CFG_ENABLE_MC_ADDR_LIST to CCM\n");
      }
 
+#ifdef WLAN_FEATURE_11AC
+   /* Based on cfg.ini, update the Basic MCS set, RX/TX MCS map in the cfg.dat */
+   /* valid values are 0(MCS0-7), 1(MCS0-8), 2(MCS0-9) */
+   /* we update only the least significant 2 bits in the corresponding fields */
+   if( (pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) ||
+       (pConfig->dot11Mode == eHDD_DOT11_MODE_11ac_ONLY) ||
+       (pConfig->dot11Mode == eHDD_DOT11_MODE_11ac) )
+   {
+       {
+           tANI_U32 temp = 0;
+
+           ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_VHT_BASIC_MCS_SET, &temp);
+           temp = (temp & 0xFFFC) | pConfig->vhtRxMCS; 
+
+           if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_VHT_BASIC_MCS_SET, 
+                           temp, NULL, eANI_BOOLEAN_FALSE)
+               ==eHAL_STATUS_FAILURE)
+           {
+               fStatus = FALSE;
+               hddLog(LOGE, "Could not pass on WNI_CFG_VHT_BASIC_MCS_SET to CCM\n");
+           }
+
+           ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_VHT_RX_MCS_MAP, &temp);
+           temp = (temp & 0xFFFC) | pConfig->vhtRxMCS; 
+
+           if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_VHT_RX_MCS_MAP, 
+                           temp, NULL, eANI_BOOLEAN_FALSE)
+               ==eHAL_STATUS_FAILURE)
+           {
+              fStatus = FALSE;
+              hddLog(LOGE, "Could not pass on WNI_CFG_VHT_RX_MCS_MAP to CCM\n");
+           }
+
+           ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_VHT_TX_MCS_MAP, &temp);
+           temp = (temp & 0xFFFC) | pConfig->vhtTxMCS; 
+
+           if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_VHT_TX_MCS_MAP, 
+                           temp, NULL, eANI_BOOLEAN_FALSE)
+               ==eHAL_STATUS_FAILURE)
+           {
+               fStatus = FALSE;
+               hddLog(LOGE, "Could not pass on WNI_CFG_VHT_TX_MCS_MAP to CCM\n");
+           }
+       }
+   }
+#endif
+
    return fStatus;
 }
 
@@ -2839,18 +2942,13 @@
 #endif
    //Remaining config params not obtained from registry
    // On RF EVB beacon using channel 1.
-   
+#ifdef WLAN_FEATURE_11AC
+    smeConfig.csrConfig.nVhtChannelWidth = pConfig->vhtChannelWidth;
+#endif
    smeConfig.csrConfig.AdHocChannel5G            = 44; 
    smeConfig.csrConfig.ProprietaryRatesEnabled   = 0;  
    smeConfig.csrConfig.HeartbeatThresh50         = 40; 
-   if( smeConfig.csrConfig.Is11dSupportEnabled )
-   {
-      smeConfig.csrConfig.Is11hSupportEnabled    = 1;
-   }
-   else
-   {
-      smeConfig.csrConfig.Is11hSupportEnabled    = 0;
-   }
+   smeConfig.csrConfig.Is11hSupportEnabled       = 1;
    smeConfig.csrConfig.bandCapability            = pConfig->nBandCapability; 
    smeConfig.csrConfig.cbChoice                  = 0;   
    smeConfig.csrConfig.bgScanInterval            = 0; 
@@ -2858,7 +2956,8 @@
    smeConfig.csrConfig.nTxPowerCap = pConfig->nTxPowerCap;
    smeConfig.csrConfig.fEnableBypass11d          = pConfig->enableBypass11d;
    smeConfig.csrConfig.fEnableDFSChnlScan        = pConfig->enableDFSChnlScan;
-   
+   smeConfig.csrConfig.fFirstScanOnly2GChnl      = pConfig->enableFirstScan2GOnly;
+
    //FIXME 11d config is hardcoded
 #ifdef WLAN_SOFTAP_FEATURE
    if ( VOS_STA_SAP_MODE != hdd_get_conparam()){
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 6088825..ef35511 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -410,6 +410,7 @@
  */
 int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand)
 {
+    ENTER();
     switch(eBand)
     {
         case eCSR_BAND_24:
@@ -438,6 +439,8 @@
                                hdd_config_t *pCfg
                                )
 {
+    ENTER();
+
     /* Now bind the underlying wlan device with wiphy */
     set_wiphy_dev(wiphy, dev);
 
@@ -448,7 +451,8 @@
                     | WIPHY_FLAG_CUSTOM_REGULATORY;
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-    wiphy->flags |=   WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+    wiphy->flags |=   WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL 
+                    | WIPHY_FLAG_OFFCHAN_TX;
 #endif
 
     wiphy->max_scan_ssids = MAX_SCAN_SSID; 
@@ -536,6 +540,8 @@
     /* Register for all P2P action, public action etc frames */
     v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4);
 
+    ENTER();
+
    /* Right now we are registering these frame when driver is getting
       initialized. Once we will move to 2.6.37 kernel, in which we have
       frame register ops, we will move this code as a part of that */
@@ -574,6 +580,8 @@
     /* Register for all P2P action, public action etc frames */
     v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4);
 
+    ENTER();
+
    /* Right now we are registering these frame when driver is getting
       initialized. Once we will move to 2.6.37 kernel, in which we have
       frame register ops, we will move this code as a part of that */
@@ -676,6 +684,7 @@
     beacon_data_t *old = NULL;
     int head_len,tail_len;
 
+    ENTER();
     if (params->head && !params->head_len)
         return -EINVAL;
 
@@ -882,6 +891,7 @@
     v_U8_t *pIe = NULL;
     v_U8_t addIE[1] = {0};
     beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon;
+    int ret = 0;
 
     genie = vos_mem_malloc(MAX_GENIE_LEN);
 
@@ -903,7 +913,8 @@
         else 
         {
             hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too big***\n");
-            return -EINVAL;
+            ret = -EINVAL;
+            goto done;
         }
         total_ielen = ielen;
     }
@@ -919,7 +930,8 @@
         }
         else {
            hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie + P2p Ie + Wfd Ie Length is too big***\n");
-           return -EINVAL;
+           ret = -EINVAL;
+           goto done;
         }
         total_ielen += ielen; 
     }
@@ -939,7 +951,8 @@
         {
             hddLog( VOS_TRACE_LEVEL_ERROR, 
                     "**Wps Ie+ P2pIE Length is too big***\n");
-            return -EINVAL;
+            ret = -EINVAL;
+            goto done;
         }
         total_ielen += ielen;
     }
@@ -951,7 +964,8 @@
     {
         hddLog(LOGE,
                "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM");
-        return -EINVAL;
+        ret = -EINVAL;
+        goto done;
     }
 
     if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
@@ -962,7 +976,8 @@
     {
         hddLog(LOGE,
             "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM");
-        return -EINVAL;
+        ret = -EINVAL;
+        goto done;
     }
 
     // Added for ProResp IE
@@ -1002,7 +1017,8 @@
             {
                  hddLog(LOGE,
                        "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM");
-                 return -EINVAL;
+                 ret = -EINVAL;
+                 goto done;
             }
             rem_probe_resp_ie_len += probe_rsp_ie_len[0];
         }
@@ -1017,7 +1033,8 @@
             {
                  hddLog(LOGE,
                        "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM");
-                 return -EINVAL;
+                 ret = -EINVAL;
+                 goto done;
             }
             rem_probe_resp_ie_len += probe_rsp_ie_len[1];
         }
@@ -1032,7 +1049,8 @@
             {
                  hddLog(LOGE,
                        "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM");
-                 return -EINVAL;
+                 ret = -EINVAL;
+                 goto done;
             }
             rem_probe_resp_ie_len += probe_rsp_ie_len[2];
         }
@@ -1067,7 +1085,8 @@
         {
            hddLog(LOGE,
              "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM");
-           return -EINVAL;
+           ret = -EINVAL;
+           goto done;
         }
     }
     else
@@ -1090,7 +1109,8 @@
        {
             hddLog(LOGE,
                   "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM");
-            return -EINVAL;
+            ret = -EINVAL;
+            goto done;
        }
 
        if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
@@ -1101,7 +1121,8 @@
        {
           hddLog(LOGE,
             "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM");
-          return -EINVAL;
+          ret = -EINVAL;
+          goto done;
        }
     }
     else
@@ -1119,6 +1140,7 @@
         }
     }
 
+done:
     vos_mem_free(genie);
     return 0;
 }
@@ -1445,6 +1467,15 @@
     }
     wlan_hdd_set_sapHwmode(pHostapdAdapter);
 
+#ifdef WLAN_FEATURE_11AC
+    if(((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_AUTO) || 
+       ((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_11ac) ||
+       ((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_11ac_ONLY) )
+    {
+        pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac;
+    }
+#endif
+
     // ht_capab is not what the name conveys,this is used for protection bitmap
     pConfig->ht_capab =
                  (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection;
@@ -1625,9 +1656,23 @@
 #endif
 {
     hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *pHddCtx;
+    hdd_context_t  *pHddCtx    = NULL;
+    hdd_scaninfo_t *pScanInfo  = NULL;
+    hdd_adapter_t  *staAdapter = NULL;
     VOS_STATUS status = 0;
 
+    staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION);
+
+    if (!staAdapter)
+    {
+        staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT);
+    }
+
+    if (staAdapter != NULL)
+    {
+        pScanInfo =  &staAdapter->scan_info;
+    }
+
     ENTER();
 
     if (NULL == pAdapter)
@@ -1647,6 +1692,23 @@
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
                               __func__,pAdapter->device_mode);
 
+    if ((pScanInfo != NULL) && pScanInfo->mScanPending)
+    {
+        INIT_COMPLETION(staAdapter->abortscan_event_var);
+        hdd_abort_mac_scan(staAdapter->pHddCtx);
+        status = wait_for_completion_interruptible_timeout(
+                           &staAdapter->abortscan_event_var,
+                           msecs_to_jiffies(WLAN_WAIT_TIME_ABORTSCAN));
+        if (!status)
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                         "%s: Timeout occured while waiting for abortscan" ,
+                         __FUNCTION__);
+            VOS_ASSERT(pScanInfo->mScanPending);
+            return 0;
+        }
+    }
+
     if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
 #ifdef WLAN_FEATURE_P2P
      || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
@@ -1892,6 +1954,7 @@
     if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION)
 #ifdef WLAN_FEATURE_P2P
       || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
+      || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE)
 #endif
       )
     {
@@ -1908,8 +1971,14 @@
                 hddLog(VOS_TRACE_LEVEL_INFO,
                    "%s: setting interface Type to INFRASTRUCTURE", __func__);
                 pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
-                pRoamProfile->phyMode =
-                   hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
+#ifdef WLAN_FEATURE_11AC
+                if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO)
+                {
+                    pConfig->dot11Mode = eHDD_DOT11_MODE_11ac;
+                }
+#endif
+                pRoamProfile->phyMode = 
+                hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
                 wdev->iftype = type;
 #ifdef WLAN_FEATURE_P2P
                 pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ?
@@ -2005,6 +2074,10 @@
                 status = hdd_init_station_mode( pAdapter );
                 if( VOS_STATUS_SUCCESS != status )
                     return -EOPNOTSUPP;
+                /* In case of JB, for P2P-GO, only change interface will be called,
+                 * This is the right place to enable back bmps_imps()
+                 */
+                hdd_enable_bmps_imps(pHddCtx);
                 goto done;
             case NL80211_IFTYPE_AP:
 #ifdef WLAN_FEATURE_P2P
@@ -2082,6 +2155,8 @@
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
     v_MACADDR_t STAMacAddress;
 
+    ENTER();
+
     if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -2108,6 +2183,7 @@
         }
     }
     
+    EXIT();
     return status;
 }
 
@@ -2711,6 +2787,7 @@
         }
     }
 #endif
+    EXIT();
     return status;
 }
 
@@ -3048,12 +3125,27 @@
     struct cfg80211_bss *bss_status = NULL;
     size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length;
     int rssi = 0;
+#ifdef WLAN_OPEN_SOURCE
+    struct timespec ts;
+#endif
 
     ENTER();
 
     memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN);
+
+#ifdef WLAN_OPEN_SOURCE
+    /* Android does not want the timestamp from the frame.
+       Instead it wants a monotonic increasing value */
+    get_monotonic_boottime(&ts);
+    mgmt->u.probe_resp.timestamp =
+         ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000);
+#else
+    /* keep old behavior for non-open source (for now) */
     memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp,
             sizeof (bss_desc->timeStamp));
+
+#endif
+
     mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval;
     mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo;
     memcpy(mgmt->u.probe_resp.variable, ie, ie_length);
@@ -3242,16 +3334,16 @@
 
 #define dump_bssid(bssid) \
     { \
-        hddLog(VOS_TRACE_LEVEL_FATAL, "BSSID (MAC) address:\t"); \
-        hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_FATAL);\
-        hddLog(VOS_TRACE_LEVEL_FATAL, "\n"); \
+        hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \
+        hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\
+        hddLog(VOS_TRACE_LEVEL_INFO, "\n"); \
     }
 
 #define dump_pmkid(pMac, pmkid) \
     { \
-        hddLog(VOS_TRACE_LEVEL_FATAL, "PMKSA-ID:\t"); \
-        hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_FATAL);\
-        hddLog(VOS_TRACE_LEVEL_FATAL, "\n"); \
+        hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \
+        hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\
+        hddLog(VOS_TRACE_LEVEL_INFO, "\n"); \
     }
 
 #ifdef FEATURE_WLAN_LFR
@@ -3263,10 +3355,11 @@
                     hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, 
                     int index, bool preauth )
 {
+#ifdef FEATURE_WLAN_OKC
     struct net_device *dev = pAdapter->dev;
 
     ENTER();
-    printk("%s is going to notify supplicant of:", __func__);
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s is going to notify supplicant of:", __func__);
 
     if( NULL == pRoamInfo )
     {
@@ -3277,7 +3370,7 @@
     dump_bssid(pRoamInfo->bssid);
     cfg80211_pmksa_candidate_notify(dev, index,
                                     pRoamInfo->bssid, preauth, GFP_KERNEL);
-
+#endif  /* FEATURE_WLAN_OKC */
     return 0; 
 }
 #endif //FEATURE_WLAN_LFR
@@ -3294,7 +3387,6 @@
     //struct wireless_dev *wdev = dev->ieee80211_ptr;    
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
     hdd_scaninfo_t *pScanInfo = &pAdapter->scan_info;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
     struct cfg80211_scan_request *req = NULL;
     int ret = 0;
 
@@ -3312,13 +3404,13 @@
     if (!ret)
     {
        VOS_ASSERT(pScanInfo->mScanPending);
-       return 0;
+       goto allow_suspend;
     }
 
     if(pScanInfo->mScanPending != VOS_TRUE)
     {
         VOS_ASSERT(pScanInfo->mScanPending);
-        return 0;
+        goto allow_suspend;
     }
 
     /* Check the scanId */
@@ -3330,9 +3422,6 @@
                 (int) scanId);
     }
 
-    /* Scan is no longer pending */
-    pScanInfo->mScanPending = VOS_FALSE;
-
     ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, 
                                         pAdapter);
 
@@ -3372,7 +3461,7 @@
     if (!req)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL\n");
-        return 0;
+        goto allow_suspend;
     }
 
     /*
@@ -3389,21 +3478,27 @@
     cfg80211_scan_done(req, false);
     complete(&pAdapter->abortscan_event_var);
     pAdapter->request = NULL;
+    /* Scan is no longer pending */
+    pScanInfo->mScanPending = VOS_FALSE;
 
 #ifdef WLAN_FEATURE_P2P
     /* Flush out scan result after p2p_serach is done */
-    if(pScanInfo->p2pSearch )
+    if(pScanInfo->flushP2pScanResults)
     {
         tANI_U8 sessionId = pAdapter->sessionId;
-        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
-        { 
-            sessionId = pAdapter->p2pSessionId;
-        } 
         sme_ScanFlushResult(WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId);
-        pScanInfo->p2pSearch = 0;
+        pScanInfo->flushP2pScanResults = 0;
     }
 #endif
 
+allow_suspend:
+    /* release the wake lock */
+    if((eConnectionState_NotConnected == 
+         (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
+    {
+        hdd_allow_suspend();
+    }
+
     EXIT();
     return 0;
 }
@@ -3425,6 +3520,7 @@
     v_U32_t scanId = 0;
     int status = 0;
     hdd_scaninfo_t *pScanInfo = &pAdapter->scan_info;
+    v_U8_t preventSuspend = 0;
 #ifdef WLAN_FEATURE_P2P
     v_U8_t* pP2pIe = NULL;
 #endif
@@ -3585,7 +3681,8 @@
             pScanInfo->scanAddIE.length = request->ie_len;
 
             if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
-                (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)
+                (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ||
+                (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)
               )
             {
                pwextBuf->roamProfile.pAddIEScan = pScanInfo->scanAddIE.addIEdata;
@@ -3600,25 +3697,38 @@
                                                        request->ie_len);
             if (pP2pIe != NULL)
             {
-                if ( (request->n_ssids == 1) && 
-                     (request->ssids[0].ssid_len == P2P_WILDCARD_SSID_LEN) &&
-                     !memcmp(request->ssids[0].ssid, P2P_WILDCARD_SSID,
-                             P2P_WILDCARD_SSID_LEN ))
+                /* no_cck will be set during p2p find to disable 11b rates */
+                if(TRUE == request->no_cck)
                 {
                     tANI_U8 sessionId = pAdapter->sessionId;
                     hddLog(VOS_TRACE_LEVEL_INFO,
                            "%s: This is a P2P Search", __func__);
                     scanRequest.p2pSearch = 1;
-                    pScanInfo->p2pSearch = 1;
+
+                    /* Flush the scan results only for P2P search.
+                       P2P search happens on 3 social channels (1, 6, 11) */
+                    if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS )
+                    {
+                         pScanInfo->flushP2pScanResults = 1;
+                         sme_ScanFlushResult( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                          sessionId );
+                    }
+
+                    /*
+                       Skip Dfs Channel in case of P2P Search
+                       if it is set in ini file
+                    */
+                    if(cfg_param->skipDfsChnlInP2pSearch)
+                    {
+                       scanRequest.skipDfsChnlInP2pSearch = 1;
+                    }
+                    else
+                    {
+                       scanRequest.skipDfsChnlInP2pSearch = 0;
+                    }
 
                     /* set requestType to P2P Discovery */
                     scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY;
-                    if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
-                    {
-                        sessionId = pAdapter->p2pSessionId;
-                    }
-                    sme_ScanFlushResult( WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                          sessionId );
                 }
             }
 #endif
@@ -3627,26 +3737,29 @@
 
     INIT_COMPLETION(pScanInfo->scan_req_completion_event);
 
-    if ((pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated) &&
-        (scanRequest.p2pSearch))
+    /*If the station is not connected and recieved a scan request, acquire the 
+     * wake lock to not request the suspend from Android*/
+    if((eConnectionState_NotConnected == 
+         (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
     {
-        status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
-                              pAdapter->p2pSessionId, &scanRequest, &scanId,
-                              &hdd_cfg80211_scan_done_callback, dev );
+        preventSuspend = 1;
+        hdd_prevent_suspend();
     }
-    else
-    {
-        status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
+
+    status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
                               pAdapter->sessionId, &scanRequest, &scanId,
                               &hdd_cfg80211_scan_done_callback, dev );
-    }
-    
+
     if (eHAL_STATUS_SUCCESS != status)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                 "%s: sme_ScanRequest returned error %d", __func__, status);
         complete(&pScanInfo->scan_req_completion_event);
         status = -EIO;
+        if(preventSuspend)
+        {
+            hdd_allow_suspend();
+        }
         goto free_mem;
     }
 
@@ -3698,9 +3811,14 @@
 
     if (pRoamProfile) 
     {
-        if (hdd_connGetConnectedBssType(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
-            &connectedBssType ) || ( eMib_dot11DesiredBssType_independent == 
-              connectedBssType))
+        int ret = 0;
+        hdd_station_ctx_t *pHddStaCtx;
+        pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+        hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType );
+
+        if((eMib_dot11DesiredBssType_independent == connectedBssType) ||
+           (eConnectionState_Associated == pHddStaCtx->conn_info.connState) ||
+           (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState))
         {
             /* Issue disconnect to CSR */
             INIT_COMPLETION(pAdapter->disconnect_comp_var);
@@ -3709,9 +3827,23 @@
                             pAdapter->sessionId,
                             eCSR_DISCONNECT_REASON_UNSPECIFIED ) )
             {
-                wait_for_completion_interruptible_timeout(
-                        &pAdapter->disconnect_comp_var,
-                        msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+                ret = wait_for_completion_interruptible_timeout(
+                             &pAdapter->disconnect_comp_var,
+                             msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+                if (0 == ret)
+                {
+                    VOS_ASSERT(0);
+                }
+            }
+        }
+        else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState)
+        {
+            ret = wait_for_completion_interruptible_timeout(
+                         &pAdapter->disconnect_comp_var,
+                         msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+            if (0 == ret)
+            {
+                VOS_ASSERT(0);
             }
         }
 
@@ -4952,6 +5084,8 @@
     hdd_adapter_t *pAdapter;
     hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
 
+    ENTER();
+
     if (NULL == pHddCtx)
     {
         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
@@ -4976,6 +5110,7 @@
     wlan_hdd_get_classAstats(pAdapter);
     *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr;
 
+    EXIT();
     return 0;
 }
 
@@ -5005,6 +5140,8 @@
     tANI_U8  rateFlag = 1;
     tANI_U8  i, j, rssidx;
 
+    ENTER();
+
     if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) ||
             (0 == ssidlen))
     {
@@ -5081,7 +5218,7 @@
         ccmCfgGetStr(hHal, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, &ORLeng);
         for (i = 0; i < ORLeng; i++)
         {
-            for (j = 0; j < sizeof(supported_data_rate); j ++)
+            for (j = 0; j < (sizeof(supported_data_rate) / sizeof(supported_data_rate[0])); j ++)
             {
                 /* Validate Rate Set */
                 if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F))
@@ -5098,7 +5235,7 @@
         ccmCfgGetStr(hHal, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedRates, &ERLeng);
         for (i = 0; i < ERLeng; i++)
         {
-            for (j = 0; j < sizeof(supported_data_rate); j ++)
+            for (j = 0; j < (sizeof(supported_data_rate) / sizeof(supported_data_rate[0])); j ++)
             {
                 if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F))
                 {
@@ -5128,7 +5265,7 @@
 
             for (i = 0; i < MCSLeng; i++)
             {
-                for (j = 0; j < sizeof(supported_mcs_rate); j++)
+                for (j = 0; j < (sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0])); j++)
                 {
                     if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i])
                     {
@@ -5220,6 +5357,7 @@
     }
     sinfo->filled |= STATION_INFO_TX_BITRATE;
 
+    EXIT();
     return 0;
 }
 
@@ -5229,6 +5367,8 @@
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     VOS_STATUS vos_status;
 
+    ENTER();
+
     if (NULL == pAdapter)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL\n", __func__);
@@ -5247,6 +5387,7 @@
      **/
     vos_status =  wlan_hdd_enter_bmps(pAdapter, !mode);
 
+    EXIT();
     if (VOS_STATUS_E_FAILURE == vos_status)
     {
         return -EINVAL;
@@ -5260,6 +5401,7 @@
                          struct net_device *netdev,
                          u8 key_index)
 {
+    ENTER();
     return 0;
 }
 #endif //LINUX_VERSION_CODE 
@@ -5269,12 +5411,14 @@
                    struct net_device *dev,
                    struct ieee80211_txq_params *params)
 {
+    ENTER();
     return 0;
 }
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
 static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
                    struct ieee80211_txq_params *params)
 {
+    ENTER();
     return 0;
 }
 #endif //LINUX_VERSION_CODE
@@ -5284,6 +5428,7 @@
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
 
+    ENTER();
     if ( NULL == pAdapter || NULL == pAdapter->pHddCtx)
     {
         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Invalid Adapter or HDD Context " ,__func__);
@@ -5349,6 +5494,7 @@
           struct net_device *dev, u8 *mac, struct station_parameters *params)
 {
     // TODO: Implement this later.
+    ENTER();
     return 0;
 }
 
@@ -5366,6 +5512,8 @@
     eHalStatus result; 
     tANI_U8  BSSIDMatched = 0;
    
+    ENTER();
+
     // Validate pAdapter  
     if ( NULL == pAdapter || NULL == pAdapter->pHddCtx)
     {
@@ -5444,12 +5592,14 @@
 static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
             struct cfg80211_pmksa *pmksa)
 {
+    ENTER();
     // TODO: Implement this later.
     return 0;
 }
 
 static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev)
 {
+    ENTER();
     // TODO: Implement this later.
     return 0;
 }
diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c
index 47ea1d6..3ad6fd0 100644
--- a/CORE/HDD/src/wlan_hdd_early_suspend.c
+++ b/CORE/HDD/src/wlan_hdd_early_suspend.c
@@ -40,7 +40,6 @@
 #include <linux/pm.h>
 #include <linux/wait.h>
 #include <linux/earlysuspend.h>
-#include <linux/wcnss_wlan.h>
 #include <wlan_hdd_includes.h>
 #include <wlan_qct_driver.h>
 #include <linux/wakelock.h>
@@ -81,6 +80,7 @@
 #include "bap_hdd_misc.h"
 #endif
 
+#include <linux/wcnss_wlan.h>
 #include <linux/inetdevice.h>
 #include <wlan_hdd_cfg.h>
 /**-----------------------------------------------------------------------------
@@ -118,7 +118,7 @@
 #endif
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
-extern void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set);
+extern void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set, v_U8_t sessionId);
 #endif
 
 //Callback invoked by PMC to report status of standby request
@@ -698,7 +698,8 @@
                   offLoadRequest.params.hostIpv4Addr[3]);
 
           if (eHAL_STATUS_SUCCESS != 
-                    sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter) , &offLoadRequest))
+                    sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), 
+                                       pAdapter->sessionId, &offLoadRequest))
           {
               hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to enable HostOffload "
                       "feature\n", __func__);
@@ -718,7 +719,8 @@
        offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE;
        offLoadRequest.offloadType =  SIR_IPV4_ARP_REPLY_OFFLOAD;
 
-       if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), &offLoadRequest))
+       if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, 
+                                                     &offLoadRequest))
        {
             hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to disable host "
                              "offload feature\n", __func__);
@@ -764,6 +766,7 @@
        pHddCtx->hdd_mcastbcast_filter_set = TRUE;
 }
 
+#ifdef CONFIG_HAS_EARLYSUSPEND
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
 static void hdd_conf_suspend_ind(hdd_context_t* pHddCtx,
                                  hdd_adapter_t *pAdapter)
@@ -871,7 +874,7 @@
                     (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
            {
               /*set the filter*/
-              wlan_hdd_set_mc_addr_list(pHddCtx, TRUE);
+              wlan_hdd_set_mc_addr_list(pHddCtx, TRUE, pAdapter->sessionId);
            }
         }
 #endif
@@ -884,7 +887,7 @@
     }
 }
 
-static void hdd_conf_resume_ind(hdd_context_t* pHddCtx)
+static void hdd_conf_resume_ind(hdd_context_t* pHddCtx, v_U8_t sessionId)
 {
     VOS_STATUS vstatus;
     tpSirWlanResumeParam wlanResumeParam =
@@ -929,14 +932,13 @@
        {
           /*Filter applied during suspend mode*/
           /*Clear it here*/
-          wlan_hdd_set_mc_addr_list(pHddCtx, FALSE);
+          wlan_hdd_set_mc_addr_list(pHddCtx, FALSE, sessionId);
        }
     }
 #endif
 }
 #endif
 
-#ifdef CONFIG_HAS_EARLYSUSPEND
 //Suspend routine registered with Android OS
 void hdd_suspend_wlan(struct early_suspend *wlan_suspend)
 {
@@ -1030,8 +1032,13 @@
        }
 #endif
 
+   //Apply Dynamic Dtim For P2P
+   //Only if ignoreDynamicDtimInP2pMode is not set in ini
    if((pHddCtx->cfg_ini->enableDynamicDTIM ||
-       pHddCtx->cfg_ini->enableModulatedDTIM) && 
+       pHddCtx->cfg_ini->enableModulatedDTIM) &&
+       ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
+        ((WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) &&
+         !(pHddCtx->cfg_ini->ignoreDynamicDtimInP2pMode))) &&
        (eANI_BOOLEAN_TRUE == pAdapter->higherDtimTransition) &&
       (eConnectionState_Associated == 
          (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) &&
@@ -1312,7 +1319,7 @@
 
          if(pHddCtx->hdd_mcastbcast_filter_set == TRUE) {
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
-           hdd_conf_resume_ind(pHddCtx);
+           hdd_conf_resume_ind(pHddCtx, pAdapter->sessionId);
 #else
                   hdd_conf_mcastbcast_filter(pHddCtx, FALSE);
                               pHddCtx->hdd_mcastbcast_filter_set = FALSE;
@@ -2182,11 +2189,13 @@
       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddRegisterPmOps failed",__func__);
       goto err_bap_stop;
    }
+#ifdef CONFIG_HAS_EARLYSUSPEND
    // Register suspend/resume callbacks
    if(pHddCtx->cfg_ini->nEnableSuspend)
    {
       register_wlan_suspend();
    }
+#endif
    /* Allow the phone to go to sleep */
    hdd_allow_suspend();
    /* register for riva power on lock */
diff --git a/CORE/HDD/src/wlan_hdd_ftm.c b/CORE/HDD/src/wlan_hdd_ftm.c
index f3122db..b6ba3d5 100644
--- a/CORE/HDD/src/wlan_hdd_ftm.c
+++ b/CORE/HDD/src/wlan_hdd_ftm.c
@@ -2607,6 +2607,9 @@
 
     ENTER();
 
+    //Delay to fix NV write failure on JB
+    vos_busy_wait(10000); //10ms
+
     if (!pRequestBuf) {
 
         hddLog(VOS_TRACE_LEVEL_ERROR,"%s: request buffer is null\n",__func__);
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index 83b5eb6..b7e5166 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -203,7 +203,7 @@
        goto exit;
     }
 
-    if ((!ifr) && (!ifr->ifr_data))
+    if ((!ifr) || (!ifr->ifr_data))
     {
         ret = -EINVAL;
         goto exit;
@@ -1057,6 +1057,43 @@
     return 0;
 }
 
+int
+static iw_softap_set_tx_power(struct net_device *dev,
+                        struct iw_request_info *info,
+                        union iwreq_data *wrqu, char *extra)
+{
+    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
+    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+    int cmd_len = wrqu->data.length;
+    int *value = (int *) kmalloc(cmd_len+1, GFP_KERNEL);
+    int set_value;
+    tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+    tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+
+    if(value == NULL)
+        return -ENOMEM;
+
+    if(copy_from_user((char *) value, (char*)(wrqu->data.pointer), cmd_len)) {
+        hddLog(VOS_TRACE_LEVEL_FATAL, "%s -- copy_from_user --data pointer failed! bailing",
+                __FUNCTION__);
+        kfree(value);
+        return -EFAULT;
+    }
+
+    set_value = value[0];
+    kfree(value);
+
+    if( sme_SetMaxTxPower(hHal, bssid, selfMac, set_value) !=
+            eHAL_STATUS_SUCCESS )
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed",
+                __func__);
+        return -EIO;
+    }
+
+    return 0;
+}
+
 #define IS_BROADCAST_MAC(x) (((x[0] & x[1] & x[2] & x[3] & x[4] & x[5]) == 0xff) ? 1 : 0)
 
 int
@@ -1833,11 +1870,11 @@
 static int iw_get_ap_freq(struct net_device *dev, struct iw_request_info *info,
              struct iw_freq *fwrq, char *extra)
 {
-   v_U32_t status = 0,channel,freq;
+   v_U32_t status = FALSE, channel = 0, freq = 0;
    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
    tHalHandle hHal;
    hdd_hostapd_state_t *pHostapdState;
-   hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);  
+   hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
 
    ENTER();
 
@@ -1860,18 +1897,30 @@
        else
        {
           status = hdd_wlan_get_freq(channel, &freq);
-          fwrq->m = freq;
-          fwrq->e = 0;
+          if( TRUE == status)
+          {
+              /* Set Exponent parameter as 6 (MHZ) in struct iw_freq
+               * iwlist & iwconfig command shows frequency into proper
+               * format (2.412 GHz instead of 246.2 MHz)*/
+              fwrq->m = freq;
+              fwrq->e = MHZ;
+          }
        }
     }
     else
     {
        channel = pHddApCtx->operatingChannel;
        status = hdd_wlan_get_freq(channel, &freq);
-       fwrq->m = freq;
-       fwrq->e = 0;
+       if( TRUE == status)
+       {
+          /* Set Exponent parameter as 6 (MHZ) in struct iw_freq
+           * iwlist & iwconfig command shows frequency into proper
+           * format (2.412 GHz instead of 246.2 MHz)*/
+           fwrq->m = freq;
+           fwrq->e = MHZ;
+       }
     }
-   return status;
+   return 0;
 }
 
 static int iw_softap_setwpsie(struct net_device *dev,
@@ -2518,7 +2567,13 @@
         IW_PRIV_TYPE_BYTE | sizeof(tChannelListInfo),
         "getChannelList" },
 
+    /* handlers for main ioctl */
+    {   QCSAP_IOCTL_SET_TX_POWER,
+        IW_PRIV_TYPE_INT| IW_PRIV_SIZE_FIXED | 1,
+        0,
+        "" },
 };
+
 static const iw_handler hostapd_private[] = {
    [QCSAP_IOCTL_SETPARAM - SIOCIWFIRSTPRIV] = iw_softap_setparam,  //set priv ioctl
    [QCSAP_IOCTL_GETPARAM - SIOCIWFIRSTPRIV] = iw_softap_getparam,  //get priv ioctl   
@@ -2538,7 +2593,8 @@
    [QCSAP_IOCTL_SET_CHANNEL_RANGE - SIOCIWFIRSTPRIV] = iw_softap_set_channel_range,
    [QCSAP_IOCTL_MODIFY_ACL - SIOCIWFIRSTPRIV]   = iw_softap_modify_acl,
    [QCSAP_IOCTL_GET_CHANNEL_LIST - SIOCIWFIRSTPRIV]   = iw_softap_get_channel_list,
-   [QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED - SIOCIWFIRSTPRIV]     = iw_get_softap_linkspeed
+   [QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED - SIOCIWFIRSTPRIV]     = iw_get_softap_linkspeed,
+   [QCSAP_IOCTL_SET_TX_POWER - SIOCIWFIRSTPRIV]   = iw_softap_set_tx_power,
 };
 const struct iw_handler_def hostapd_handler_def = {
    .num_standard     = sizeof(hostapd_handler) / sizeof(hostapd_handler[0]),
@@ -2641,20 +2697,11 @@
             ( pAdapter->device_mode == WLAN_HDD_SOFTAP ) && 
             ( !strncmp( pAdapter->dev->name, "wlan", 4 )) )
     {
-        hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
-        {
-            INIT_COMPLETION(pAdapter->session_close_comp_var);
-            if( eHAL_STATUS_SUCCESS == sme_CloseSession( pHddCtx->hHal,
-                        pAdapter->p2pSessionId,
-                        hdd_smeCloseSessionCallback, pAdapter ) )
-            {
-                //Block on a completion variable. Can't wait forever though.
-                wait_for_completion_interruptible_timeout(
-                        &pAdapter->session_close_comp_var,
-                        msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
-            }
-        }
+       /* TODO: Revisit this later, either unregister p2p0 
+                interface here or make change in wifi.c file to pass 
+                information, that driver is getting loaded for SAP interface, 
+                in that case, during load time don't start p2p0 interface 
+        */
     }
 #endif
     EXIT();
diff --git a/CORE/HDD/src/wlan_hdd_innav.c b/CORE/HDD/src/wlan_hdd_innav.c
deleted file mode 100644
index 1e9b029..0000000
--- a/CORE/HDD/src/wlan_hdd_innav.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 9e64d20..9f59945 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -144,11 +144,25 @@
 module_param_string(fwpath, fwpath, BUF_LEN,
                     S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
+/*
+ * The rate at which the driver sends RESTART event to supplicant
+ * once the function 'vos_wlanRestart()' is called
+ *
+ */
+#define WLAN_HDD_RESTART_RETRY_DELAY_MS 5000  /* 5 second */
+#define WLAN_HDD_RESTART_RETRY_MAX_CNT  5     /* 5 retries */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
 static struct wake_lock wlan_wake_lock;
+#endif
 /* set when SSR is needed after unload */
 static v_U8_t      isSsrRequired;
 
 //internal function declaration
+static VOS_STATUS wlan_hdd_framework_restart(hdd_context_t *pHddCtx);
+static void wlan_hdd_restart_init(hdd_context_t *pHddCtx);
+static void wlan_hdd_restart_deinit(hdd_context_t *pHddCtx);
+void wlan_hdd_restart_timer_cb(v_PVOID_t usrDataForCallback);
+
 v_U16_t hdd_select_queue(struct net_device *dev,
     struct sk_buff *skb);
 
@@ -173,7 +187,7 @@
 
    //Make sure that this callback corresponds to our device.
    if((strncmp( dev->name, "wlan", 4 )) && 
-      (strncmp( dev->name, "p2p-wlan", 8))
+      (strncmp( dev->name, "p2p", 3))
      )
       return NOTIFY_DONE;
 
@@ -207,11 +221,8 @@
         break;
 
    case NETDEV_CHANGE:
-        if(VOS_STA_MODE == hdd_get_conparam()) 
-        {
-            if(TRUE == pAdapter->isLinkUpSvcNeeded)
-               complete(&pAdapter->linkup_event_var);
-           }
+        if(TRUE == pAdapter->isLinkUpSvcNeeded)
+           complete(&pAdapter->linkup_event_var);
         break;
 
    case NETDEV_GOING_DOWN:
@@ -342,7 +353,7 @@
       goto exit; 
    }
 
-   if ((!ifr) && (!ifr->ifr_data))
+   if ((!ifr) || (!ifr->ifr_data))
    {
        ret = -EINVAL;
        goto exit; 
@@ -1268,65 +1279,6 @@
    return status;
 }
 
-#ifdef WLAN_FEATURE_P2P
-/**
- * hdd_init_p2p_device_mode
- *
- *FUNCTION:
- * This function is called from hdd_wlan_startup function when wlan 
- * driver module is loaded. 
- *
- *LOGIC:
- * Open New SME session with P2P Device Mac Address which is different 
- * from STA Mac Address SME session. When driver receive any frame on STA Mac 
- * Address then we divert all the frame using P2P Device Mac Address instaed of 
- * STA Mac address. 
- *
- *ASSUMPTIONS:
- *
- *
- *NOTE:
- *
- * @param  pAdapter   Pointer to pAdapter structure
- *
- * @return None
- */
-VOS_STATUS hdd_init_p2p_device_mode( hdd_adapter_t *pAdapter)
-{
-   hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
-   eHalStatus halStatus = eHAL_STATUS_SUCCESS;
-   VOS_STATUS status = VOS_STATUS_E_FAILURE;
-   int rc = 0;
-
-   INIT_COMPLETION(pAdapter->session_open_comp_var);
-   //Open a SME session for future operation
-   halStatus = sme_OpenSession( pHddCtx->hHal, hdd_smeRoamCallback, pAdapter,
-               (tANI_U8 *)&pHddCtx->p2pDeviceAddress, &pAdapter->p2pSessionId);
-   if ( !HAL_STATUS_SUCCESS( halStatus ) )
-   {
-      hddLog(VOS_TRACE_LEVEL_FATAL,
-             "sme_OpenSession() failed with status code %08d [x%08lx]",
-                                                 halStatus, halStatus );
-      status = VOS_STATUS_E_FAILURE;
-      return status;
-   }
-   
-   //Block on a completion variable. Can't wait forever though.
-   rc = wait_for_completion_interruptible_timeout(
-                        &pAdapter->session_open_comp_var,
-                        msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
-   if (!rc)
-   {
-      hddLog(VOS_TRACE_LEVEL_FATAL,
-             "Session is not opened within timeout period code %08d", rc );
-      status = VOS_STATUS_E_FAILURE;
-      return status;
-   }
-
-   return VOS_STATUS_SUCCESS;
-}
-#endif
-
 #ifdef CONFIG_CFG80211
 void hdd_cleanup_actionframe( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter )
 {
@@ -1358,6 +1310,7 @@
    {
       case WLAN_HDD_INFRA_STATION:
       case WLAN_HDD_P2P_CLIENT:
+      case WLAN_HDD_P2P_DEVICE:
       {
          if(test_bit(INIT_TX_RX_SUCCESS, &pAdapter->event_flags))
          {
@@ -1598,6 +1551,7 @@
       case WLAN_HDD_INFRA_STATION:
 #ifdef WLAN_FEATURE_P2P
       case WLAN_HDD_P2P_CLIENT:
+      case WLAN_HDD_P2P_DEVICE:
 #endif
       {
          pAdapter = hdd_alloc_station_adapter( pHddCtx, macAddr, iface_name );
@@ -1606,12 +1560,11 @@
             return NULL;
 
 #ifdef CONFIG_CFG80211
-         pAdapter->wdev.iftype = (session_type == WLAN_HDD_INFRA_STATION) ?
-                                  NL80211_IFTYPE_STATION :
-                                  NL80211_IFTYPE_P2P_CLIENT;
+         pAdapter->wdev.iftype = (session_type == WLAN_HDD_P2P_CLIENT) ?
+                                  NL80211_IFTYPE_P2P_CLIENT:
+                                  NL80211_IFTYPE_STATION;
 #endif
 
-
          pAdapter->device_mode = session_type;
 
          status = hdd_init_station_mode( pAdapter );
@@ -1900,6 +1853,7 @@
    {
       case WLAN_HDD_INFRA_STATION:
       case WLAN_HDD_P2P_CLIENT:
+      case WLAN_HDD_P2P_DEVICE:
          if( hdd_connIsConnected( WLAN_HDD_GET_STATION_CTX_PTR( pAdapter )) )
          {
             if (pWextState->roamProfile.BSSType == eCSR_BSS_TYPE_START_IBSS)
@@ -2085,6 +2039,7 @@
       {
          case WLAN_HDD_INFRA_STATION:
          case WLAN_HDD_P2P_CLIENT:
+         case WLAN_HDD_P2P_DEVICE:
             hdd_init_station_mode(pAdapter);
             /* Open the gates for HDD to receive Wext commands */
             pAdapter->isLinkUpSvcNeeded = FALSE; 
@@ -2677,6 +2632,9 @@
 
    ENTER();
 
+   // Unloading, restart logic is no more required.
+   wlan_hdd_restart_deinit(pHddCtx);
+
 #ifdef CONFIG_CFG80211
 #ifdef WLAN_SOFTAP_FEATURE
    if (VOS_STA_SAP_MODE != hdd_get_conparam())
@@ -2820,26 +2778,6 @@
    // Unregister the Net Device Notifier
    unregister_netdevice_notifier(&hdd_netdev_notifier);
    
-#ifdef WLAN_FEATURE_P2P
-   if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
-   {
-       hdd_adapter_t* pAdapter = hdd_get_adapter(pHddCtx,
-                                    WLAN_HDD_INFRA_STATION);
-       if (pAdapter != NULL)
-       {
-          INIT_COMPLETION(pAdapter->session_close_comp_var);
-          if( eHAL_STATUS_SUCCESS == sme_CloseSession( pHddCtx->hHal,
-                                        pAdapter->p2pSessionId,
-                                        hdd_smeCloseSessionCallback, pAdapter ) )
-          {
-              //Block on a completion variable. Can't wait forever though.
-              wait_for_completion_interruptible_timeout(
-                         &pAdapter->session_close_comp_var,
-                         msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
-          }
-       }
-   }
-#endif
    hdd_stop_all_adapters( pHddCtx );
 
 #ifdef ANI_BUS_TYPE_SDIO
@@ -2939,7 +2877,11 @@
          "%s: Failed to close VOSS Scheduler",__func__);
       VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
    }
-   
+
+#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
+   /* Destroy the wake lock */
+   wake_lock_destroy(&pHddCtx->rx_wake_lock);
+#endif
 
    //Close VOSS
    //This frees pMac(HAL) context. There should not be any call that requires pMac access after this.
@@ -3182,12 +3124,20 @@
 /* wake lock APIs for HDD */
 void hdd_prevent_suspend(void)
 {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
     wake_lock(&wlan_wake_lock);
+#else
+    wcnss_prevent_suspend();
+#endif
 }
 
 void hdd_allow_suspend(void)
 {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
     wake_unlock(&wlan_wake_lock);
+#else
+    wcnss_allow_suspend();
+#endif
 }
 
 /**---------------------------------------------------------------------------
@@ -3206,6 +3156,7 @@
 {
    VOS_STATUS status;
    hdd_adapter_t *pAdapter = NULL;
+   hdd_adapter_t *pP2pAdapter = NULL;
    hdd_context_t *pHddCtx = NULL;
    v_CONTEXT_t pVosContext= NULL;
 #ifdef WLAN_BTAMP_FEATURE
@@ -3420,6 +3371,17 @@
       goto err_vosclose;
    }
 
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+      /* Vos preStart is calling */
+      /* vos preStart which does cfg download should be called before set sme config which accesses/sets some cfgs */
+      status = vos_preStart( pHddCtx->pvosContext );
+      if ( !VOS_IS_STATUS_SUCCESS( status ) )
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_preStart failed",__func__);
+         goto err_vosclose;
+      }
+#endif
+
    // Set the SME configuration parameters...
    status = hdd_set_sme_config( pHddCtx );
 
@@ -3438,16 +3400,6 @@
    }
 
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
-   /* Vos preStart is calling */
-   status = vos_preStart( pHddCtx->pvosContext );
-   if ( !VOS_IS_STATUS_SUCCESS( status ) )
-   {
-      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_preStart failed",__func__);
-      goto err_vosclose;
-   }
-#endif
-
-#ifdef FEATURE_WLAN_INTEGRATED_SOC
    /* In the integrated architecture we update the configuration from
       the INI file and from NV before vOSS has been started so that
       the final contents are available to send down to the cCPU   */
@@ -3627,11 +3579,20 @@
       pr_info("%s: WCNSS hardware version %s\n",
               WLAN_MODULE_NAME, versionString);
 
-      /* Check if FW version is greater than 0.1.1.0. Only then send host-FW capability exchange message */
-      if ((versionReported.major>0) || (versionReported.minor>1) || ((versionReported.minor>=1) && (versionReported.version>=1)))
+      /* 1.Check if FW version is greater than 0.1.1.0. Only then send host-FW capability exchange message 
+              2.Host-FW capability exchange message  is only present on riva 1.1 so 
+                send the message only if it the riva is 1.1
+                minor numbers for different riva branches:
+                0 -> (1.0)Mainline Build
+                1 -> (1.1)Mainline Build
+                2->(1.04) Stability Build
+         */
+      if (((versionReported.major>0) || (versionReported.minor>1) || 
+         ((versionReported.minor>=1) && (versionReported.version>=1)))
+         && ((versionReported.major == 1) && (versionReported.minor >= 1)))
          fwFeatCapsMsgSupported = 1;
       if (fwFeatCapsMsgSupported)
-        sme_featureCapsExchange(pHddCtx->hHal);
+         sme_featureCapsExchange(pHddCtx->hHal);
    } while (0);
 
 #endif // FEATURE_WLAN_INTEGRATED_SOC
@@ -3658,26 +3619,44 @@
      if (pAdapter != NULL)
      {
 #ifdef WLAN_FEATURE_P2P
-         vos_mem_copy( pHddCtx->p2pDeviceAddress.bytes, 
-                       pHddCtx->cfg_ini->intfMacAddr[0].bytes,
-                       sizeof(tSirMacAddr));
          if ( pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated )
          {
+             vos_mem_copy( pHddCtx->p2pDeviceAddress.bytes,
+                       pHddCtx->cfg_ini->intfMacAddr[0].bytes,
+                       sizeof(tSirMacAddr));
              /* Generate the P2P Device Address.  This consists of the device's
               * primary MAC address with the locally administered bit set.
               */
              pHddCtx->p2pDeviceAddress.bytes[0] |= 0x02;
-             status = hdd_init_p2p_device_mode(pAdapter);
-             if ( VOS_STATUS_SUCCESS != status )
+         }
+         else
+         {
+             tANI_U8* p2p_dev_addr = wlan_hdd_get_intf_addr(pHddCtx);
+             if (p2p_dev_addr != NULL)
              {
-                 hddLog(VOS_TRACE_LEVEL_FATAL,
-                         "%s: Init Session fail for P2P Device Address Mode ",
-                          __FUNCTION__);
-                 goto err_close_adapter;
+                vos_mem_copy(&pHddCtx->p2pDeviceAddress.bytes[0],
+                             p2p_dev_addr, VOS_MAC_ADDR_SIZE);
+             }
+             else
+             {
+                hddLog(VOS_TRACE_LEVEL_FATAL,
+                    "%s: Failed to allocate mac_address for p2p_device",
+                    __FUNCTION__);
+                goto err_close_adapter;
              }
          }
+
+         pP2pAdapter = hdd_open_adapter( pHddCtx, WLAN_HDD_P2P_DEVICE, "p2p%d",
+                           &pHddCtx->p2pDeviceAddress.bytes[0], FALSE );
+         if ( NULL == pP2pAdapter )
+         {
+             hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: Failed to do hdd_open_adapter for P2P Device Interface",
+                __FUNCTION__);
+             goto err_close_adapter;
+         }
 #endif
-    }
+     }
 #ifdef WLAN_SOFTAP_FEATURE
    }
 #endif
@@ -3691,15 +3670,14 @@
      goto err_clkvote;
 #endif
    }
-   
-     
+
 #ifdef WLAN_BTAMP_FEATURE
    vStatus = WLANBAP_Open(pVosContext);
    if(!VOS_IS_STATUS_SUCCESS(vStatus))
    {
      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
         "%s: Failed to open BAP",__func__);
-      goto err_p2psession_close;
+      goto err_close_adapter;
    }
 
    vStatus = BSL_Init(pVosContext);
@@ -3722,7 +3700,7 @@
    status = WLANBAP_SetConfig(&btAmpConfig);
 
 #endif //WLAN_BTAMP_FEATURE
- 
+
 #ifdef FEATURE_WLAN_SCAN_PNO
    /*SME must send channel update configuration to RIVA*/
    sme_UpdateChannelConfig(pHddCtx->hHal); 
@@ -3737,7 +3715,7 @@
 #ifdef WLAN_BTAMP_FEATURE
       goto err_bap_stop;
 #else
-      goto err_p2psession_close; 
+      goto err_close_adapter; 
 #endif //WLAN_BTAMP_FEATURE
    }
 
@@ -3813,7 +3791,7 @@
    if (VOS_STA_SAP_MODE != hdd_get_conparam())
 #endif
    {
-      wlan_hdd_cfg80211_post_voss_start(pAdapter);
+      wlan_hdd_cfg80211_post_voss_start(pP2pAdapter);
    }
 #endif
 
@@ -3821,11 +3799,21 @@
 
    pHddCtx->isLoadUnloadInProgress = FALSE;
 
+#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
+   /* Initialize the wake lcok */
+   wake_lock_init(&pHddCtx->rx_wake_lock,
+           WAKE_LOCK_SUSPEND,
+           "qcom_rx_wakelock");
+#endif
+
    vos_event_init(&pAdapter->scan_info.scan_finished_event);
    pAdapter->scan_info.scan_pending_option = WEXT_SCAN_PENDING_GIVEUP;
 
    vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, FALSE);
    hdd_allow_suspend();
+   
+   // Initialize the restart logic
+   wlan_hdd_restart_init(pHddCtx);
   
    goto success;
 
@@ -3852,29 +3840,6 @@
    WLANBAP_Close(pVosContext);
 #endif
 
-err_p2psession_close:
-#ifdef WLAN_FEATURE_P2P
-   if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
-   {
-       hdd_adapter_t* pAdapter = hdd_get_adapter(pHddCtx,
-                                    WLAN_HDD_INFRA_STATION);
-
-       if (pAdapter != NULL)
-       {
-          INIT_COMPLETION(pAdapter->session_close_comp_var);
-          if( eHAL_STATUS_SUCCESS == sme_CloseSession( pHddCtx->hHal,
-                                        pAdapter->p2pSessionId,
-                                        hdd_smeCloseSessionCallback, pAdapter ) )
-          {
-              //Block on a completion variable. Can't wait forever though.
-              wait_for_completion_interruptible_timeout(
-                         &pAdapter->session_close_comp_var,
-                         msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
-          }
-       }
-   }
-#endif
-
 err_close_adapter:
    hdd_close_all_adapters( pHddCtx );
 
@@ -3968,7 +3933,9 @@
 
    ENTER();
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
    wake_lock_init(&wlan_wake_lock, WAKE_LOCK_SUSPEND, "wlan");
+#endif
 
    pr_info("%s: loading driver v%s\n", WLAN_MODULE_NAME,
            QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR);
@@ -4146,7 +4113,9 @@
       vos_mem_exit();
 #endif
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
       wake_lock_destroy(&wlan_wake_lock);
+#endif
       pr_err("%s: driver load failure\n", WLAN_MODULE_NAME);
    }
    else
@@ -4179,7 +4148,6 @@
 {
    hdd_context_t *pHddCtx = NULL;
    v_CONTEXT_t pVosContext = NULL;
-   int attempts = 0;
 
    pr_info("%s: unloading driver v%s\n", WLAN_MODULE_NAME, QWLAN_VERSIONSTR);
 
@@ -4201,13 +4169,10 @@
    }
    else
    {
+      /* module exit should never proceed if SSR is not completed */
       while(isWDresetInProgress()){
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Reset in Progress by LOGP. Block rmmod for 500ms!!!",__func__);
-         VOS_ASSERT(0);
-         msleep(500);
-         attempts++;
-         if(attempts==MAX_EXIT_ATTEMPTS_DURING_LOGP)
-           break;
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:SSR in Progress; block rmmod for 1 second!!!",__func__);
+         msleep(1000);
        }
 
       pHddCtx->isLoadUnloadInProgress = TRUE;
@@ -4231,7 +4196,9 @@
 #endif
 
 done:
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
    wake_lock_destroy(&wlan_wake_lock);
+#endif
    pr_info("%s: driver unloaded\n", WLAN_MODULE_NAME);
 }
 
@@ -4426,8 +4393,8 @@
        case WLAN_HDD_P2P_GO:
 #endif
        case WLAN_HDD_SOFTAP:
-    pHddCtx->concurrency_mode |= (1 << mode);
-    pHddCtx->no_of_sessions[mode]++;
+            pHddCtx->concurrency_mode |= (1 << mode);
+            pHddCtx->no_of_sessions[mode]++;
             break;
        default:
             break;
@@ -4459,6 +4426,189 @@
     __func__,pHddCtx->concurrency_mode,mode,pHddCtx->no_of_sessions[mode]);
 }
 
+/**---------------------------------------------------------------------------
+ *
+ *   \brief wlan_hdd_restart_init
+ *
+ *   This function initalizes restart timer/flag. An internal function.
+ *
+ *   \param  - pHddCtx
+ *
+ *   \return - None
+ *             
+ * --------------------------------------------------------------------------*/
+
+static void wlan_hdd_restart_init(hdd_context_t *pHddCtx)
+{
+   /* Initialize */
+   pHddCtx->hdd_restart_retries = 0;
+   atomic_set(&pHddCtx->isRestartInProgress, 0);
+   vos_timer_init(&pHddCtx->hdd_restart_timer, 
+                     VOS_TIMER_TYPE_SW, 
+                     wlan_hdd_restart_timer_cb,
+                     pHddCtx);
+}
+/**---------------------------------------------------------------------------
+ *
+ *   \brief wlan_hdd_restart_deinit
+ *
+ *   This function cleans up the resources used. An internal function.
+ *
+ *   \param  - pHddCtx
+ *
+ *   \return - None
+ *             
+ * --------------------------------------------------------------------------*/
+
+static void wlan_hdd_restart_deinit(hdd_context_t* pHddCtx)
+{
+ 
+   VOS_STATUS vos_status;
+   /* Block any further calls */
+   atomic_set(&pHddCtx->isRestartInProgress, 1);
+   /* Cleanup */
+   vos_status = vos_timer_stop( &pHddCtx->hdd_restart_timer );
+   if (!VOS_IS_STATUS_SUCCESS(vos_status))
+          hddLog(LOGE, FL("Failed to stop HDD restart timer\n"));
+   vos_status = vos_timer_destroy(&pHddCtx->hdd_restart_timer);
+   if (!VOS_IS_STATUS_SUCCESS(vos_status))
+          hddLog(LOGE, FL("Failed to destroy HDD restart timer\n"));
+
+}
+
+/**---------------------------------------------------------------------------
+ *
+ *   \brief wlan_hdd_framework_restart
+ *
+ *   This function uses a cfg80211 API to start a framework initiated WLAN
+ *   driver module unload/load.
+ *
+ *   Also this API keep retrying (WLAN_HDD_RESTART_RETRY_MAX_CNT).
+ *
+ *
+ *   \param  - pHddCtx
+ *
+ *   \return - VOS_STATUS_SUCCESS: Success
+ *             VOS_STATUS_E_EMPTY: Adapter is Empty
+ *             VOS_STATUS_E_NOMEM: No memory
+
+ * --------------------------------------------------------------------------*/
+
+static VOS_STATUS wlan_hdd_framework_restart(hdd_context_t *pHddCtx) 
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+   int len = (sizeof (struct ieee80211_mgmt));
+   struct ieee80211_mgmt *mgmt = NULL; 
+   
+   /* Prepare the DEAUTH managment frame with reason code */
+   mgmt =  kzalloc(len, GFP_KERNEL);
+   if(mgmt == NULL) 
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, 
+            "%s: memory allocatoin failed (%d bytes)", __func__, len);
+      return VOS_STATUS_E_NOMEM;
+   }
+   mgmt->u.deauth.reason_code = WLAN_REASON_DISASSOC_LOW_ACK;
+
+   /* Iterate over all adapters/devices */
+   status =  hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+   do 
+   {
+      if( (status == VOS_STATUS_SUCCESS) && 
+                           pAdapterNode  && 
+                           pAdapterNode->pAdapter)
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, 
+               "restarting the driver(intf:\'%s\' mode:%d :try %d)",
+               pAdapterNode->pAdapter->dev->name,
+               pAdapterNode->pAdapter->device_mode,
+               pHddCtx->hdd_restart_retries + 1);
+         /* 
+          * CFG80211 event to restart the driver
+          * 
+          * 'cfg80211_send_unprot_deauth' sends a 
+          * NL80211_CMD_UNPROT_DEAUTHENTICATE event to supplicant at any state 
+          * of SME(Linux Kernel) state machine.
+          *
+          * Reason code WLAN_REASON_DISASSOC_LOW_ACK is currently used to restart
+          * the driver.
+          *
+          */
+         
+         cfg80211_send_unprot_deauth(pAdapterNode->pAdapter->dev, (u_int8_t*)mgmt, len );  
+      }
+      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+      pAdapterNode = pNext;
+   } while((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status));
+
+
+   /* Free the allocated management frame */
+   kfree(mgmt);
+
+   /* Retry until we unload or reach max count */
+   if(++pHddCtx->hdd_restart_retries < WLAN_HDD_RESTART_RETRY_MAX_CNT) 
+      vos_timer_start(&pHddCtx->hdd_restart_timer, WLAN_HDD_RESTART_RETRY_DELAY_MS);
+
+   return status;
+
+}
+/**---------------------------------------------------------------------------
+ *
+ *   \brief wlan_hdd_restart_timer_cb
+ *
+ *   Restart timer callback. An internal function.
+ *
+ *   \param  - User data:
+ *
+ *   \return - None
+ *             
+ * --------------------------------------------------------------------------*/
+
+void wlan_hdd_restart_timer_cb(v_PVOID_t usrDataForCallback)
+{
+   hdd_context_t *pHddCtx = usrDataForCallback;
+   wlan_hdd_framework_restart(pHddCtx);
+   return;
+
+}
+
+
+/**---------------------------------------------------------------------------
+ *
+ *   \brief wlan_hdd_restart_driver
+ *
+ *   This function sends an event to supplicant to restart the WLAN driver. 
+ *   
+ *   This function is called from vos_wlanRestart.
+ *
+ *   \param  - pHddCtx
+ *
+ *   \return - VOS_STATUS_SUCCESS: Success
+ *             VOS_STATUS_E_EMPTY: Adapter is Empty
+ *             VOS_STATUS_E_ALREADY: Request already in progress
+
+ * --------------------------------------------------------------------------*/
+VOS_STATUS wlan_hdd_restart_driver(hdd_context_t *pHddCtx) 
+{
+   VOS_STATUS status = VOS_STATUS_SUCCESS;
+
+   /* A tight check to make sure reentrancy */
+   if(atomic_xchg(&pHddCtx->isRestartInProgress, 1))
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, 
+            "%s: WLAN restart is already in progress", __func__);
+
+      return VOS_STATUS_E_ALREADY;
+   }
+
+   /* Restart API */
+   status = wlan_hdd_framework_restart(pHddCtx);
+   
+   return status;
+}
+
+
 //Register the module init/exit functions
 module_init(hdd_module_init);
 module_exit(hdd_module_exit);
diff --git a/CORE/HDD/src/wlan_hdd_oemdata.c b/CORE/HDD/src/wlan_hdd_oemdata.c
new file mode 100644
index 0000000..6243662
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_oemdata.c
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
+ *
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef FEATURE_OEM_DATA_SUPPORT
+
+/*================================================================================ 
+    \file wlan_hdd_oemdata.c
+  
+    \brief Linux Wireless Extensions for oem data req/rsp
+  
+    $Id: wlan_hdd_oemdata.c,v 1.34 2010/04/15 01:49:23 -- VINAY
+  
+    Copyright (C) Qualcomm Inc.
+    
+================================================================================*/
+
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/wireless.h>
+#include <wlan_hdd_includes.h>
+#include <net/arp.h>
+
+/*---------------------------------------------------------------------------------------------
+
+  \brief hdd_OemDataReqCallback() - 
+
+  This function also reports the results to the user space
+
+  \return - 0 for success, non zero for failure
+
+-----------------------------------------------------------------------------------------------*/
+static eHalStatus hdd_OemDataReqCallback(tHalHandle hHal, 
+        void *pContext,
+        tANI_U32 oemDataReqID,
+        eOemDataReqStatus oemDataReqStatus)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    struct net_device *dev = (struct net_device *) pContext;
+    union iwreq_data wrqu;
+    char buffer[IW_CUSTOM_MAX+1];
+
+    memset(&wrqu, '\0', sizeof(wrqu));
+    memset(buffer, '\0', sizeof(buffer));
+
+    //now if the status is success, then send an event up
+    //so that the application can request for the data
+    //else no need to send the event up
+    if(oemDataReqStatus == eOEM_DATA_REQ_FAILURE)
+    {
+        snprintf(buffer, IW_CUSTOM_MAX, "QCOM: OEM-DATA-REQ-FAILED");
+        hddLog(LOGW, "%s: oem data req %d failed\n", __FUNCTION__, oemDataReqID);
+    }
+    else if(oemDataReqStatus == eOEM_DATA_REQ_INVALID_MODE)
+    {
+        snprintf(buffer, IW_CUSTOM_MAX, "QCOM: OEM-DATA-REQ-INVALID-MODE");
+        hddLog(LOGW, "%s: oem data req %d failed because the driver is in invalid mode (IBSS|BTAMP|AP)\n", __FUNCTION__, oemDataReqID);
+    }
+    else
+    {
+        snprintf(buffer, IW_CUSTOM_MAX, "QCOM: OEM-DATA-REQ-SUCCESS");
+        //everything went alright
+    }
+    
+    wrqu.data.pointer = buffer;
+    wrqu.data.length = strlen(buffer);
+        
+    wireless_send_event(dev, IWEVCUSTOM, &wrqu, buffer);
+
+    return status;
+}
+
+/**--------------------------------------------------------------------------------------------
+
+  \brief iw_get_oem_data_rsp() - 
+
+  This function gets the oem data response. This invokes
+  the respective sme functionality. Function for handling the oem data rsp 
+  IOCTL 
+
+  \param - dev  - Pointer to the net device
+         - info - Pointer to the iw_oem_data_req
+         - wrqu - Pointer to the iwreq data
+         - extra - Pointer to the data
+
+  \return - 0 for success, non zero for failure
+
+-----------------------------------------------------------------------------------------------*/
+int iw_get_oem_data_rsp(
+        struct net_device *dev, 
+        struct iw_request_info *info,
+        union iwreq_data *wrqu,
+        char *extra)
+{
+    eHalStatus                            status = eHAL_STATUS_SUCCESS;
+    struct iw_oem_data_rsp*               pHddOemDataRsp;
+    tOemDataRsp*                          pSmeOemDataRsp;
+
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+
+    do
+    {
+        //get the oem data response from sme
+        status = sme_getOemDataRsp(WLAN_HDD_GET_HAL_CTX(pAdapter), &pSmeOemDataRsp);
+        if(status != eHAL_STATUS_SUCCESS)
+        {
+            hddLog(LOGE, "%s: failed in sme_getOemDataRsp\n", __FUNCTION__);
+            break;
+        }
+        else
+        {
+            if(pSmeOemDataRsp != NULL)
+            {
+                pHddOemDataRsp = (struct iw_oem_data_rsp*)(extra);
+                vos_mem_copy(pHddOemDataRsp->oemDataRsp, pSmeOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE); 
+            }
+            else
+            {
+                hddLog(LOGE, "%s: pSmeOemDataRsp = NULL\n", __FUNCTION__);
+                status = eHAL_STATUS_FAILURE;
+                break;
+            }
+        }
+    } while(0);
+
+    return eHAL_STATUS_SUCCESS;
+}
+
+/**--------------------------------------------------------------------------------------------
+
+  \brief iw_set_oem_data_req() - 
+
+  This function sets the oem data req configuration. This invokes
+  the respective sme oem data req functionality. Function for 
+  handling the set IOCTL for the oem data req configuration
+
+  \param - dev  - Pointer to the net device
+     - info - Pointer to the iw_oem_data_req
+     - wrqu - Pointer to the iwreq data
+     - extra - Pointer to the data
+
+  \return - 0 for success, non zero for failure
+
+-----------------------------------------------------------------------------------------------*/
+int iw_set_oem_data_req(
+        struct net_device *dev, 
+        struct iw_request_info *info,
+        union iwreq_data *wrqu,
+        char *extra)
+{
+    eHalStatus status = eHAL_STATUS_SUCCESS;
+    struct iw_oem_data_req *pOemDataReq = NULL;
+    tOemDataReqConfig oemDataReqConfig;
+
+    tANI_U32 oemDataReqID = 0;
+
+    hdd_adapter_t *pAdapter = (netdev_priv(dev));
+    hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+
+
+    do
+    {
+        if(NULL != wrqu->data.pointer)
+        {
+            pOemDataReq = (struct iw_oem_data_req *)wrqu->data.pointer;
+        }
+
+        if(pOemDataReq == NULL)
+        {
+            hddLog(LOGE, "in %s oemDataReq == NULL\n", __FUNCTION__);
+            status = eHAL_STATUS_FAILURE;
+            break;
+        }
+
+        vos_mem_zero(&oemDataReqConfig, sizeof(tOemDataReqConfig));
+
+        vos_mem_copy((&oemDataReqConfig)->oemDataReq, pOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE);
+    
+        status = sme_OemDataReq(WLAN_HDD_GET_HAL_CTX(pAdapter), 
+                                                pAdapter->sessionId,
+                                                &oemDataReqConfig, 
+                                                &oemDataReqID, 
+                                                &hdd_OemDataReqCallback, 
+                                                dev);
+    
+        pwextBuf->oemDataReqID = oemDataReqID;
+        pwextBuf->oemDataReqInProgress = TRUE;
+
+    } while(0);
+    
+    return status;
+}
+
+
+#endif
diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c
index 5a08e10..418cc70 100644
--- a/CORE/HDD/src/wlan_hdd_p2p.c
+++ b/CORE/HDD/src/wlan_hdd_p2p.c
@@ -63,7 +63,6 @@
                                                 eHalStatus status )
 {
     hdd_adapter_t *pAdapter = (hdd_adapter_t*) pCtx;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
     hdd_remain_on_chan_ctx_t *pRemainChanCtx = cfgState->remain_on_chan_ctx;
 
@@ -95,15 +94,11 @@
     vos_mem_free( pRemainChanCtx );
 
     if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
-         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode )
+         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
+         ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
        )
     {
         tANI_U8 sessionId = pAdapter->sessionId;
-        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
-        {
-            if ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode )
-                sessionId = pAdapter->p2pSessionId;
-        }
         sme_DeregisterMgmtFrame(
                    hHal, sessionId,
                    (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_PROBE_REQ << 4),
@@ -131,7 +126,6 @@
                                    rem_on_channel_request_type_t request_type )
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
     hdd_remain_on_chan_ctx_t *pRemainChanCtx;
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
     int status = 0;
@@ -144,9 +138,9 @@
 
     if( cfgState->remain_on_chan_ctx != NULL)
     {
-        /* Wait till remain on channel ready indication before issuing cancel 
-         * remain on channel request, otherwise if remain on channel not 
-         * received and if the driver issues cancel remain on channel then lim 
+        /* Wait till remain on channel ready indication before issuing cancel
+         * remain on channel request, otherwise if remain on channel not
+         * received and if the driver issues cancel remain on channel then lim
          * will be in unknown state.
          */
         status = wait_for_completion_interruptible_timeout(&pAdapter->rem_on_chan_ready_event,
@@ -159,13 +153,14 @@
         }
 
         INIT_COMPLETION(pAdapter->cancel_rem_on_chan_var);
-        
+
         /* Issue abort remain on chan request to sme.
          * The remain on channel callback will make sure the remain_on_chan
          * expired event is sent.
         */
         if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
-             ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode )
+             ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
+             ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
            )
         {
             sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter ),
@@ -178,14 +173,14 @@
             WLANSAP_CancelRemainOnChannel(
                                      (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
         }
-        
+
         wait_for_completion_interruptible_timeout(&pAdapter->cancel_rem_on_chan_var,
                msecs_to_jiffies(WAIT_CANCEL_REM_CHAN));
     }
 
-    /* When P2P-GO and if we are trying to unload the driver then 
+    /* When P2P-GO and if we are trying to unload the driver then
      * wlan driver is keep on receiving the remain on channel command
-     * and which is resulting in crash. So not allowing any remain on 
+     * and which is resulting in crash. So not allowing any remain on
      * channel requets when Load/Unload is in progress*/
     if (((hdd_context_t*)pAdapter->pHddCtx)->isLoadUnloadInProgress)
     {
@@ -219,15 +214,11 @@
 
     //call sme API to start remain on channel.
     if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
-         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode )
+         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
+         ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
        )
     {
-        tANI_U8 sessionId = pAdapter->sessionId; 
-        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
-        {
-            if ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode )
-                sessionId = pAdapter->p2pSessionId;
-        }
+        tANI_U8 sessionId = pAdapter->sessionId;
         //call sme API to start remain on channel.
         sme_RemainOnChannel(
                        WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId,
@@ -253,7 +244,7 @@
            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                     "%s: WLANSAP_RemainOnChannel returned fail", __func__);
            cfgState->remain_on_chan_ctx = NULL;
-           vos_mem_free (pRemainChanCtx);             
+           vos_mem_free (pRemainChanCtx);
            return -EINVAL;
         }
 
@@ -320,7 +311,6 @@
                                       struct net_device *dev, u64 cookie )
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
     int status = 0;
 
@@ -354,15 +344,11 @@
      * expired event is sent.
      */
     if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
-         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode )
+         ( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
+         ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
        )
     {
         tANI_U8 sessionId = pAdapter->sessionId; 
-        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
-        {
-            if ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode )
-                sessionId = pAdapter->p2pSessionId;
-        }
         sme_CancelRemainOnChannel( WLAN_HDD_GET_HAL_CTX( pAdapter ),
                                             sessionId );
     }
@@ -407,11 +393,25 @@
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+    tANI_U16 extendedWait = 0;
+    tANI_U8 type = WLAN_HDD_GET_TYPE_FRM_FC(buf[0]);
+    tANI_U8 subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(buf[0]);
+    tActionFrmType actionFrmType;
+    bool noack = 0;
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
     hdd_adapter_t *goAdapter;
 #endif
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+    noack = dont_wait_for_ack;
+#endif
+
+    //If the wait is coming as 0 with off channel set
+    //then set the wait to 200 ms
+    if (offchan && !wait)
+        wait = ACTION_FRAME_DEFAULT_WAIT;
+
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
                             __func__,pAdapter->device_mode);
 
@@ -422,8 +422,6 @@
          ( WLAN_HDD_P2P_GO == pAdapter->device_mode )
        )
     {
-        tANI_U8 type = WLAN_HDD_GET_TYPE_FRM_FC(buf[0]);
-        tANI_U8 subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(buf[0]);
         if (type == SIR_MAC_MGMT_FRAME)
         {
             if (subType == SIR_MAC_MGMT_PROBE_RSP)
@@ -436,23 +434,21 @@
             else if ((subType == SIR_MAC_MGMT_DISASSOC) ||
                     (subType == SIR_MAC_MGMT_DEAUTH))
             {
-                /* Deauth/Disassoc received from supplicant, If we simply 
-                 * transmit the frame over air, driver doesn't come to know 
-                 * about the deauth/disassoc. Because of this reason the 
-                 * supplicant and driver will be out of sync.
-                 * Drop the frame here and initiate the disassoc procedure 
-                 * from driver, the core stack will take care of sending
-                 * disassoc frame and indicating corresponding events to supplicant.
+                /* During EAP failure or P2P Group Remove supplicant
+                 * is sending del_station command to driver. From
+                 * del_station function, Driver will send deauth frame to
+                 * p2p client. No need to send disassoc frame from here.
+                 * so Drop the frame here and send tx indication back to
+                 * supplicant.
                  */
                 tANI_U8 dstMac[ETH_ALEN] = {0};
                 memcpy(&dstMac, &buf[WLAN_HDD_80211_FRM_DA_OFFSET], ETH_ALEN);
-                hddLog(VOS_TRACE_LEVEL_INFO, 
+                hddLog(VOS_TRACE_LEVEL_INFO,
                         "%s: Deauth/Disassoc received for STA:"
-                        "%02x:%02x:%02x:%02x:%02x:%02x", 
-                        __func__, 
-                        dstMac[0], dstMac[1], dstMac[2], 
+                        "%02x:%02x:%02x:%02x:%02x:%02x",
+                        __func__,
+                        dstMac[0], dstMac[1], dstMac[2],
                         dstMac[3], dstMac[4], dstMac[5]);
-                hdd_softap_sta_disassoc(pAdapter, (v_U8_t *)&dstMac);
                 goto err_rem_channel;
             }
         }
@@ -487,6 +483,8 @@
            (cfgState->current_freq == chan->center_freq)
           )
         {
+            hddLog(LOG1,"action frame: extending the wait time\n");
+            extendedWait = (tANI_U16)wait;
             goto send_frame;
         }
 
@@ -519,8 +517,8 @@
     }
     else if ( offchan )
     {
-        /* Check before sending action frame 
-           whether we already remain on channel */ 
+        /* Check before sending action frame
+           whether we already remain on channel */
         if(NULL == cfgState->remain_on_chan_ctx)
         {
             goto err_rem_channel;
@@ -529,47 +527,59 @@
     send_frame:
 #endif
 
-    cfgState->buf = vos_mem_malloc( len ); //buf;
-    if( cfgState->buf == NULL )
-        return -ENOMEM;
+    if(!noack)
+    {
+        cfgState->buf = vos_mem_malloc( len ); //buf;
+        if( cfgState->buf == NULL )
+            return -ENOMEM;
 
-    cfgState->len = len;
+        cfgState->len = len;
 
-    vos_mem_copy( cfgState->buf, buf, len);
+        vos_mem_copy( cfgState->buf, buf, len);
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-    if( cfgState->remain_on_chan_ctx )
-    {
-        cfgState->action_cookie = cfgState->remain_on_chan_ctx->cookie;
-        *cookie = cfgState->action_cookie;
-    }
-    else
-    {
+        if( cfgState->remain_on_chan_ctx )
+        {
+            cfgState->action_cookie = cfgState->remain_on_chan_ctx->cookie;
+            *cookie = cfgState->action_cookie;
+        }
+        else
+        {
 #endif
-        *cookie = (tANI_U32) cfgState->buf;
-        cfgState->action_cookie = *cookie;
+            *cookie = (tANI_U32) cfgState->buf;
+            cfgState->action_cookie = *cookie;
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-    }
+        }
 #endif
+    } 
 
     if ( (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
-         (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)
+         (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ||
+         ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
        )
     {
-        tANI_U8 sessionId = pAdapter->sessionId; 
-        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
+        tANI_U8 sessionId = pAdapter->sessionId;
+        if ((type == SIR_MAC_MGMT_FRAME) &&
+                (subType == SIR_MAC_MGMT_ACTION) &&
+                (buf[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET] == WLAN_HDD_PUBLIC_ACTION_FRAME))
         {
-            if ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode )
+            actionFrmType = buf[WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET];
+            hddLog(LOG1, "Tx Action Frame %u \n", actionFrmType);
+            if (actionFrmType == WLAN_HDD_PROV_DIS_REQ)
             {
-                sessionId = pAdapter->p2pSessionId;
-                vos_mem_copy((void*) (&buf[10]), 
-                             (void*) (&pHddCtx->p2pDeviceAddress.bytes[0]),
-                                     sizeof(tSirMacAddr));
+                cfgState->actionFrmState = HDD_PD_REQ_ACK_PENDING;
+                hddLog(LOG1, "%s: HDD_PD_REQ_ACK_PENDING \n", __func__);
+            }
+            else if (actionFrmType == WLAN_HDD_GO_NEG_REQ)
+            {
+                cfgState->actionFrmState = HDD_GO_NEG_REQ_ACK_PENDING;
+                hddLog(LOG1, "%s: HDD_GO_NEG_REQ_ACK_PENDING \n", __func__);
             }
         }
+
         if (eHAL_STATUS_SUCCESS !=
                sme_sendAction( WLAN_HDD_GET_HAL_CTX(pAdapter),
-                               sessionId, buf, len) )
+                               sessionId, buf, len, extendedWait, noack))
         {
             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                      "%s: sme_sendAction returned fail", __func__);
@@ -582,7 +592,7 @@
      {
         if( VOS_STATUS_SUCCESS !=
              WLANSAP_SendAction( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
-                                  buf, len ) )
+                                  buf, len, 0 ) )
         {
             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                     "%s: WLANSAP_SendAction returned fail", __func__);
@@ -592,7 +602,10 @@
 
     return 0;
 err:
-    hdd_sendActionCnf( pAdapter, FALSE );
+    if(!noack)
+    {
+       hdd_sendActionCnf( pAdapter, FALSE );
+    }
     return 0;
 err_rem_channel:
     *cookie = (tANI_U32)cfgState;
@@ -613,10 +626,11 @@
 {
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
 
+    cfgState->actionFrmState = HDD_IDLE;
+
     hddLog( LOG1, "Send Action cnf, actionSendSuccess %d", actionSendSuccess);
     if( NULL == cfgState->buf )
     {
-        VOS_ASSERT( cfgState->buf );
         return;
     }
 
@@ -988,7 +1002,9 @@
     int needed_headroom = 0;
     int flag = HDD_RX_FLAG_IV_STRIPPED | HDD_RX_FLAG_DECRYPTED |
                HDD_RX_FLAG_MMIC_STRIPPED;
-
+#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
+    hdd_context_t* pHddCtx = (hdd_context_t*)(pMonAdapter->pHddCtx);
+#endif
     hddLog( LOG1, FL("Indicate Frame over Monitor Intf"));
 
     VOS_ASSERT( (pbFrames != NULL) );
@@ -1031,6 +1047,9 @@
      skb->dev = pMonAdapter->dev;
      skb->protocol = eth_type_trans( skb, skb->dev );
      skb->ip_summed = CHECKSUM_UNNECESSARY;
+#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
+     wake_lock_timeout(&pHddCtx->rx_wake_lock, HDD_WAKE_LOCK_DURATION);
+#endif
      rxstat = netif_rx_ni(skb);
      if( NET_RX_SUCCESS == rxstat )
      {
@@ -1049,6 +1068,10 @@
                             tANI_U32 rxChan )
 {
     tANI_U16 freq;
+    tANI_U8 type = 0;
+    tANI_U8 subType = 0; 
+    tActionFrmType actionFrmType;
+    hdd_cfg80211_state_t *cfgState = NULL;
 
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d\n",
             __func__, frameType, nFrameLength);
@@ -1106,6 +1129,27 @@
                 IEEE80211_BAND_5GHZ);
     }
 
+    type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]);
+    subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]);
+    cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+    
+    if ((type == SIR_MAC_MGMT_FRAME) && 
+            (subType == SIR_MAC_MGMT_ACTION) &&
+            (pbFrames[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET] == WLAN_HDD_PUBLIC_ACTION_FRAME))
+    {
+        actionFrmType = pbFrames[WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET];
+        hddLog(LOG1, "Rx Action Frame %u \n", actionFrmType);
+        if (((actionFrmType == WLAN_HDD_PROV_DIS_RESP) &&
+                    (cfgState->actionFrmState == HDD_PD_REQ_ACK_PENDING)) ||
+                ((actionFrmType == WLAN_HDD_GO_NEG_RESP) &&
+                 (cfgState->actionFrmState == HDD_GO_NEG_REQ_ACK_PENDING)))
+        {
+            hddLog(LOG1, "%s: ACK_PENDING and But received RESP for Action frame ", 
+                    __func__);
+            hdd_sendActionCnf(pAdapter, TRUE);
+        }
+    }
+
     //Indicate Frame Over Normal Interface
     hddLog( LOG1, FL("Indicate Frame over NL80211 Interface"));
 
@@ -1166,6 +1210,9 @@
     struct ieee80211_radiotap_header *rthdr;
     unsigned char *pos;
     struct sk_buff *skb = cfgState->skb;
+#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
+    hdd_context_t *pHddCtx = (hdd_context_t*)(pAdapter->pHddCtx);
+#endif
 
     /* 2 Byte for TX flags and 1 Byte for Retry count */
     u32 rtHdrLen = sizeof(*rthdr) + 3;
@@ -1225,6 +1272,9 @@
     skb->pkt_type  = PACKET_OTHERHOST;
     skb->protocol  = htons(ETH_P_802_2);
     memset( skb->cb, 0, sizeof( skb->cb ) );
+#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
+    wake_lock_timeout(&pHddCtx->rx_wake_lock, HDD_WAKE_LOCK_DURATION);
+#endif
     if (in_interrupt())
         netif_rx( skb );
     else
diff --git a/CORE/HDD/src/wlan_hdd_softap_tx_rx.c b/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
index 4ba1d4a..b218471 100644
--- a/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
+++ b/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
@@ -1220,6 +1220,9 @@
 
          skb->protocol = eth_type_trans(skb, skb->dev);
          skb->ip_summed = CHECKSUM_UNNECESSARY;
+#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
+         wake_lock_timeout(&pHddCtx->rx_wake_lock, HDD_WAKE_LOCK_DURATION);
+#endif
          rxstat = netif_rx_ni(skb);
          if (NET_RX_SUCCESS == rxstat)
          {
diff --git a/CORE/HDD/src/wlan_hdd_tx_rx.c b/CORE/HDD/src/wlan_hdd_tx_rx.c
index 9b5c6ec..e8ecc88 100644
--- a/CORE/HDD/src/wlan_hdd_tx_rx.c
+++ b/CORE/HDD/src/wlan_hdd_tx_rx.c
@@ -319,7 +319,7 @@
 
    if (VOS_STATUS_SUCCESS != 
       WLANSAP_SendAction( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
-                           skb->data, skb->len) )
+                           skb->data, skb->len, 0) )
    {
       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
           "%s: WLANSAP_SendAction returned fail", __func__);
@@ -1316,13 +1316,23 @@
          VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Failure extracting skb from vos pkt", __FUNCTION__);
          return VOS_STATUS_E_FAILURE;
       }
-   
+
+      if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
+      {
+         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+           "Magic cookie(%x) for adapter sanity verification is invalid", pAdapter->magic);
+         return eHAL_STATUS_FAILURE;
+      }
+
       skb->dev = pAdapter->dev;
       skb->protocol = eth_type_trans(skb, skb->dev);
       skb->ip_summed = CHECKSUM_UNNECESSARY;
       ++pAdapter->hdd_stats.hddTxRxStats.rxPackets;
       ++pAdapter->stats.rx_packets;
       pAdapter->stats.rx_bytes += skb->len;
+#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
+      wake_lock_timeout(&pHddCtx->rx_wake_lock, HDD_WAKE_LOCK_DURATION);
+#endif
       rxstat = netif_rx_ni(skb);
       if (NET_RX_SUCCESS == rxstat)
       {
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index 2624093..3041f23 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -100,6 +100,9 @@
 extern void hdd_resume_wlan(struct early_suspend *wlan_suspend);
 #endif
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+#define MAX_OEM_DATA_RSP_LEN 1024
+#endif
 
 #define HDD_FINISH_ULA_TIME_OUT    800
 
@@ -182,6 +185,9 @@
 #define WE_GET_CFG           3
 #define WE_GET_WMM_STATUS    4
 #define WE_GET_CHANNEL_LIST  5
+#ifdef WLAN_FEATURE_11AC
+#define WE_GET_RSSI          6
+#endif
 
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_NONE_GET_NONE   (SIOCIWFIRSTPRIV + 6)
@@ -219,6 +225,11 @@
 #define WAPI_CERT_AKM_SUITE 0x01721400
 #endif
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+/* Private ioctls for setting the measurement configuration */
+#define WLAN_PRIV_SET_OEM_DATA_REQ (SIOCIWFIRSTPRIV + 17)
+#define WLAN_PRIV_GET_OEM_DATA_RSP (SIOCIWFIRSTPRIV + 19)
+#endif
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
 #define WLAN_PRIV_SET_FTIES             (SIOCIWFIRSTPRIV + 20)
@@ -267,6 +278,13 @@
 #define WLAN_STATS_RX_RATE            14
 #define WLAN_STATS_TX_RATE            15
 
+#define WLAN_STATS_RX_UC_BYTE_CNT     16
+#define WLAN_STATS_RX_MC_BYTE_CNT     17
+#define WLAN_STATS_RX_BC_BYTE_CNT     18
+#define WLAN_STATS_TX_UC_BYTE_CNT     19
+#define WLAN_STATS_TX_MC_BYTE_CNT     20
+#define WLAN_STATS_TX_BC_BYTE_CNT     21
+
 #define FILL_TLV(__p, __type, __size, __val, __tlen) \
 {\
     if ((__tlen + __size + 2) < WE_MAX_STR_LEN) \
@@ -295,8 +313,9 @@
 #define WLAN_HDD_UI_SET_BAND_VALUE_OFFSET         8
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
-int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest);
-void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set);
+int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest, 
+                           v_U8_t sessionId);
+void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set, v_U8_t sessionId);
 #endif
 
 #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
@@ -408,13 +427,21 @@
 
 int hdd_wlan_get_freq(v_U32_t channel, v_U32_t *pfreq)
 {
-     if((channel > 0) && (channel <= (FREQ_CHAN_MAP_TABLE_SIZE - 1)))
-     {
-       *pfreq = freq_chan_map[channel - 1].freq * 100000;
-       return 0;
-     }
-     else
-       return -EINVAL;
+    int i;
+    if (channel > 0)
+    {
+        for (i=0; i < FREQ_CHAN_MAP_TABLE_SIZE; i++)
+        {
+            if (channel == freq_chan_map[i].chan)
+            {
+                *pfreq = freq_chan_map[i].freq;
+                return 1;
+            }
+        }
+    }
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                               ("Invalid channel no=%d!!\n"), channel);
+    return -EINVAL;
 }
 
 static v_BOOL_t
@@ -1076,7 +1103,7 @@
 static int iw_get_freq(struct net_device *dev, struct iw_request_info *info,
              struct iw_freq *fwrq, char *extra)
 {
-   v_U32_t status = 0,channel,freq = 0;
+   v_U32_t status = FALSE, channel = 0, freq = 0;
    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
    tHalHandle hHal;
    hdd_wext_state_t *pWextState;
@@ -1103,18 +1130,31 @@
        }
        else
        {
-          fwrq->m = channel;
-          fwrq->e = 0;
+           status = hdd_wlan_get_freq(channel, &freq);
+           if( TRUE == status )
+           {
+               /* Set Exponent parameter as 6 (MHZ) in struct iw_freq
+                * iwlist & iwconfig command shows frequency into proper
+                * format (2.412 GHz instead of 246.2 MHz)*/
+               fwrq->m = freq;
+               fwrq->e = MHZ;
+           }
        }
     }
     else
     {
        channel = pHddStaCtx->conn_info.operationChannel;
-       status = hdd_wlan_get_freq(channel,&freq);
-       fwrq->m = freq;
-       fwrq->e = 0;
+       status = hdd_wlan_get_freq(channel, &freq);
+       if( TRUE == status )
+       {
+          /* Set Exponent parameter as 6 (MHZ) in struct iw_freq
+           * iwlist & iwconfig command shows frequency into proper
+           * format (2.412 GHz instead of 246.2 MHz)*/
+           fwrq->m = freq;
+           fwrq->e = MHZ;
+       }
     }
-   return status;
+   return 0;
 }
 
 static int iw_get_tx_power(struct net_device *dev,
@@ -3760,7 +3800,17 @@
             wrqu->data.length = strlen(extra)+1;
             break;
         }
-
+#ifdef WLAN_FEATURE_11AC
+        case WE_GET_RSSI:
+        {
+            v_S7_t s7Rssi = 0;
+            wlan_hdd_get_rssi(pAdapter, &s7Rssi);
+            snprintf(extra, WE_MAX_STR_LEN, "rssi=%d",s7Rssi);
+            wrqu->data.length = strlen(extra)+1;
+            break;
+        }
+#endif
+           
         case WE_GET_WMM_STATUS:
         {
             snprintf(extra, WE_MAX_STR_LEN,
@@ -3786,6 +3836,7 @@
                     pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessAllowed?"YES":"NO",
                     pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcTspecInfo.ts_info.direction);
 
+
             wrqu->data.length = strlen(extra)+1;
             break;
         }
@@ -4565,7 +4616,8 @@
        exactly the same.  Otherwise, each piece of information would have to be
        copied individually. */
     memcpy(&offloadRequest, pRequest, wrqu->data.length);
-    if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), &offloadRequest))
+    if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                        pAdapter->sessionId, &offloadRequest))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute host offload request\n",
                __func__);
@@ -4628,7 +4680,8 @@
 
        hddLog(VOS_TRACE_LEVEL_ERROR, "set Keep: TP before SME %d\n", keepaliveRequest.timePeriod);
 
-    if (eHAL_STATUS_SUCCESS != sme_SetKeepAlive(WLAN_HDD_GET_HAL_CTX(pAdapter), &keepaliveRequest))
+    if (eHAL_STATUS_SUCCESS != sme_SetKeepAlive(WLAN_HDD_GET_HAL_CTX(pAdapter), 
+                                        pAdapter->sessionId, &keepaliveRequest))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Keep Alive\n",
                __func__);
@@ -4639,7 +4692,8 @@
 }
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
-int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest)
+int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest, 
+                            tANI_U8 sessionId)
 {
     tSirRcvPktFilterCfgType    packetFilterSetReq;
     tSirRcvFltPktClearParam    packetFilterClrReq;
@@ -4703,7 +4757,7 @@
                         pRequest->paramsData[i].dataMask[4], pRequest->paramsData[i].dataMask[5]);
             }
 
-            if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx, &packetFilterSetReq))
+            if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx, &packetFilterSetReq, sessionId))
             {
                 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Set Filter\n",
                         __func__);
@@ -4717,7 +4771,7 @@
             hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Clear Packet Filter Request for Id: %d\n",
                     __FUNCTION__, pRequest->filterId);
             packetFilterClrReq.filterId = pRequest->filterId;
-            if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx, &packetFilterClrReq))
+            if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx, &packetFilterClrReq, sessionId))
             {
                 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Clear Filter\n",
                         __func__);
@@ -4733,7 +4787,7 @@
     return 0;
 }
 
-void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set)
+void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set, v_U8_t sessionId)
 {
     v_U8_t filterAction = 0; 
     tPacketFilterCfg request = {0}; 
@@ -4768,7 +4822,7 @@
                     request.paramsData[0].compareData[4], 
                     request.paramsData[0].compareData[5]);
         }
-        wlan_hdd_set_filter(pHddCtx, &request);
+        wlan_hdd_set_filter(pHddCtx, &request, sessionId);
     }
     pHddCtx->mc_addr_list.isFilterApplied = set ? TRUE : FALSE;
 }
@@ -4778,7 +4832,7 @@
 {   
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     tpPacketFilterCfg pRequest = (tpPacketFilterCfg)wrqu->data.pointer;
-    return wlan_hdd_set_filter(WLAN_HDD_GET_CTX(pAdapter), pRequest);
+    return wlan_hdd_set_filter(WLAN_HDD_GET_CTX(pAdapter), pRequest, pAdapter->sessionId);
 }
 #endif
 static int iw_get_statistics(struct net_device *dev,
@@ -4904,9 +4958,9 @@
               (char*) &(pStats->rx_error_cnt),
               tlen);
 
-    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BYTE_CNT,
-              (tANI_U8) sizeof (pStats->tx_byte_cnt),
-              (char*) &(pStats->tx_byte_cnt),
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BYTE_CNT, 
+              (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]),
+              (char*) &(dStats->tx_uc_byte_cnt[0]), 
               tlen);
 
     FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BYTE_CNT,
@@ -4925,6 +4979,31 @@
               (char*) &(aStats->tx_rate),
               tlen);
 
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_UC_BYTE_CNT, 
+              (tANI_U8) sizeof (dStats->rx_uc_byte_cnt[0]), 
+              (char*) &(dStats->rx_uc_byte_cnt[0]), 
+              tlen);
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_MC_BYTE_CNT, 
+              (tANI_U8) sizeof (dStats->rx_mc_byte_cnt), 
+              (char*) &(dStats->rx_mc_byte_cnt), 
+              tlen);
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BC_BYTE_CNT, 
+              (tANI_U8) sizeof (dStats->rx_bc_byte_cnt), 
+              (char*) &(dStats->rx_bc_byte_cnt), 
+              tlen);
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_UC_BYTE_CNT, 
+              (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]), 
+              (char*) &(dStats->tx_uc_byte_cnt[0]), 
+              tlen);
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_MC_BYTE_CNT, 
+              (tANI_U8) sizeof (dStats->tx_mc_byte_cnt), 
+              (char*) &(dStats->tx_mc_byte_cnt), 
+              tlen);
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BC_BYTE_CNT, 
+              (tANI_U8) sizeof (dStats->tx_bc_byte_cnt), 
+              (char*) &(dStats->tx_bc_byte_cnt), 
+              tlen);
+
     wrqu->data.length = tlen;
 
   }
@@ -5491,7 +5570,16 @@
     }
 
     uTotalSize -= nOffset;
+    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
+              "Power request parameter %d Total size", 
+              uTotalSize);
     ptr += nOffset;
+    /* This is added for dynamic Tele LI enable (0xF1) /disable (0xF0)*/
+    if(!(uTotalSize - nOffset) && 
+       (powerRequest.uListenInterval != SIR_NOCHANGE_POWER_VALUE))
+    {
+        uTotalSize = 0;
+    }
 
   }/*Go for as long as we have a valid string*/
 
@@ -5582,6 +5670,10 @@
    [WLAN_PRIV_ADD_TSPEC             - SIOCIWFIRSTPRIV]   = iw_add_tspec,
    [WLAN_PRIV_DEL_TSPEC             - SIOCIWFIRSTPRIV]   = iw_del_tspec,
    [WLAN_PRIV_GET_TSPEC             - SIOCIWFIRSTPRIV]   = iw_get_tspec,
+#ifdef FEATURE_OEM_DATA_SUPPORT
+   [WLAN_PRIV_SET_OEM_DATA_REQ - SIOCIWFIRSTPRIV] = iw_set_oem_data_req, //oem data req Specifc
+   [WLAN_PRIV_GET_OEM_DATA_RSP - SIOCIWFIRSTPRIV] = iw_get_oem_data_rsp, //oem data req Specifc
+#endif
 
 #ifdef FEATURE_WLAN_WAPI
    [WLAN_PRIV_SET_WAPI_MODE             - SIOCIWFIRSTPRIV]  = iw_qcom_set_wapi_mode,
@@ -5801,6 +5893,12 @@
         0,
         IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
         "getConfig" },
+#ifdef WLAN_FEATURE_11AC
+    {   WE_GET_RSSI,
+        0,
+        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
+        "getRSSI" },
+#endif
     {   WE_GET_WMM_STATUS,
         0,
         IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
@@ -5869,6 +5967,21 @@
         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
         "getTspec" },
 
+#ifdef FEATURE_OEM_DATA_SUPPORT
+    /* handlers for main ioctl - OEM DATA */
+    {
+        WLAN_PRIV_SET_OEM_DATA_REQ,
+        IW_PRIV_TYPE_BYTE | sizeof(struct iw_oem_data_req) | IW_PRIV_SIZE_FIXED,
+        0,
+        "set_oem_data_req" },
+
+    /* handlers for main ioctl - OEM DATA */
+    {
+        WLAN_PRIV_GET_OEM_DATA_RSP,
+        0,
+        IW_PRIV_TYPE_BYTE | MAX_OEM_DATA_RSP_LEN,
+        "get_oem_data_rsp" },
+#endif
 
 #ifdef FEATURE_WLAN_WAPI
    /* handlers for main ioctl SET_WAPI_MODE */