Merge "wlan: Add wake lock for find AP indication" into wlan-driver.lnx.1.0-dev.1.0
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index 2dc5a2c..b6867d3 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -2159,7 +2159,8 @@
 int hdd_reassoc(hdd_adapter_t *pAdapter, const tANI_U8 *bssid,
 			const tANI_U8 channel, const handoff_src src);
 #ifdef DHCP_SERVER_OFFLOAD
-VOS_STATUS wlan_hdd_set_dhcp_server_offload(hdd_adapter_t *hostapd_adapter);
+VOS_STATUS wlan_hdd_set_dhcp_server_offload(hdd_adapter_t *hostapd_adapter,
+                                            bool re_init);
 #endif
 #ifdef MDNS_OFFLOAD
 bool wlan_hdd_set_mdns_offload(hdd_adapter_t *adapter);
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 7a51475..ae84374 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -9769,10 +9769,12 @@
 /**
  * wlan_hdd_set_dhcp_server_offload() - set dhcp server offload
  * @hostapd_adapter: pointer to hostapd adapter.
+ * @re_init: flag set if api called post ssr
  *
  * Return: None
  */
-VOS_STATUS wlan_hdd_set_dhcp_server_offload(hdd_adapter_t *hostapd_adapter)
+VOS_STATUS wlan_hdd_set_dhcp_server_offload(hdd_adapter_t *hostapd_adapter,
+					    bool re_init)
 {
 	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(hostapd_adapter);
 	sir_dhcp_srv_offload_info dhcp_srv_info;
@@ -9784,9 +9786,11 @@
 
 	ENTER();
 
-	ret = wlan_hdd_validate_context(hdd_ctx);
-	if (0 != ret)
-		return VOS_STATUS_E_INVAL;
+	if (!re_init) {
+		ret = wlan_hdd_validate_context(hdd_ctx);
+		if (0 != ret)
+			return VOS_STATUS_E_INVAL;
+	}
 
 	/* Prepare the request to send to SME */
 	dhcp_srv_info = vos_mem_malloc(sizeof(*dhcp_srv_info));
@@ -10367,7 +10371,7 @@
     /* set dhcp server offload */
     if (iniConfig->enable_dhcp_srv_offload &&
         sme_IsFeatureSupportedByFW(SAP_OFFLOADS)) {
-        status = wlan_hdd_set_dhcp_server_offload(pHostapdAdapter);
+        status = wlan_hdd_set_dhcp_server_offload(pHostapdAdapter, false);
         if (!VOS_IS_STATUS_SUCCESS(status))
         {
             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c
index 87722c6..95cf862 100644
--- a/CORE/HDD/src/wlan_hdd_early_suspend.c
+++ b/CORE/HDD/src/wlan_hdd_early_suspend.c
@@ -2392,7 +2392,7 @@
     /* set dhcp server offload */
     if (config->enable_dhcp_srv_offload &&
         sme_IsFeatureSupportedByFW(SAP_OFFLOADS)) {
-        status = wlan_hdd_set_dhcp_server_offload(adapter);
+        status = wlan_hdd_set_dhcp_server_offload(adapter, true);
         if (!VOS_IS_STATUS_SUCCESS(status))
         {
             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
diff --git a/CORE/TL/src/wlan_qct_tl.c b/CORE/TL/src/wlan_qct_tl.c
index 73eb6f1..2454477 100755
--- a/CORE/TL/src/wlan_qct_tl.c
+++ b/CORE/TL/src/wlan_qct_tl.c
@@ -698,8 +698,8 @@
   }
 
   // scheduling init to be the last one of previous round
-  pTLCb->uCurServedAC = WLANTL_AC_BK;
-  pTLCb->ucCurLeftWeight = 1;
+  pTLCb->uCurServedAC = WLANTL_AC_VO;
+  pTLCb->ucCurLeftWeight = pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC];
   pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT-1;
 
   vos_timer_init(&pTLCb->tx_frames_timer, VOS_TIMER_TYPE_SW,
@@ -11691,10 +11691,8 @@
   ++ucNextSTA;
 
   if ( WLAN_MAX_STA_COUNT <= ucNextSTA )
-  {
-    //one round is done.
     ucNextSTA = 0;
-    pTLCb->ucCurLeftWeight--;
+
     isServed = FALSE;
     if ( 0 == pTLCb->ucCurLeftWeight )
     {
@@ -11712,7 +11710,6 @@
       pTLCb->ucCurLeftWeight =  pTLCb->tlConfigInfo.ucAcWeights[pTLCb->uCurServedAC];
  
     } // (0 == pTLCb->ucCurLeftWeight)
-  } //( WLAN_MAX_STA_COUNT == ucNextSTA )
 
   ucTempSTA = ucNextSTA;
   minWeightSta = ucNextSTA;
@@ -11807,6 +11804,7 @@
                    " TL serve one station AC: %d  W: %d StaId: %d",
                    pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight, pTLCb->ucCurrentSTA ));
       
+        pTLCb->ucCurLeftWeight--;
         return VOS_STATUS_SUCCESS;
       } //STA loop
 
@@ -11859,6 +11857,7 @@
          TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
                     " TL serve one station AC: %d  W: %d StaId: %d",
                    pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight, pTLCb->ucCurrentSTA ));
+         pTLCb->ucCurLeftWeight--;
          return VOS_STATUS_SUCCESS;
       }
 
@@ -11887,6 +11886,7 @@
          TLLOG4(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW,
                     " TL serve one station AC: %d  W: %d StaId: %d",
                    pTLCb->uCurServedAC, pTLCb->ucCurLeftWeight, pTLCb->ucCurrentSTA ));
+         pTLCb->ucCurLeftWeight--;
          return VOS_STATUS_SUCCESS;
       }