Merge "qcacld-3.0: Reset the parameters which overrides the ACS" into wlan-cld3.driver.lnx.1.1-dev
diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c
index 086a2e6..b12f4cb 100644
--- a/core/hdd/src/wlan_hdd_ioctl.c
+++ b/core/hdd/src/wlan_hdd_ioctl.c
@@ -4443,13 +4443,6 @@
 		goto exit;
 	}
 
-	/* Check channel number is a valid channel number */
-	if (QDF_STATUS_SUCCESS !=
-		wlan_hdd_validate_operation_channel(adapter, channel)) {
-		hdd_err("Invalid Channel [%d]", channel);
-		return -EINVAL;
-	}
-
 	/*
 	 * if the target bssid is same as currently associated AP,
 	 * issue reassoc to same AP
@@ -4460,7 +4453,8 @@
 		hdd_info("Reassoc BSSID is same as currently associated AP bssid");
 		if (roaming_offload_enabled(hdd_ctx)) {
 			hdd_wma_send_fastreassoc_cmd((int)adapter->sessionId,
-				targetApBssid, (int)channel);
+				targetApBssid,
+				pHddStaCtx->conn_info.operationChannel);
 		} else {
 			sme_get_modify_profile_fields(hdd_ctx->hHal,
 				adapter->sessionId,
@@ -4471,6 +4465,13 @@
 		return 0;
 	}
 
+	/* Check channel number is a valid channel number */
+	if (QDF_STATUS_SUCCESS !=
+		wlan_hdd_validate_operation_channel(adapter, channel)) {
+		hdd_err("Invalid Channel [%d]", channel);
+		return -EINVAL;
+	}
+
 	if (roaming_offload_enabled(hdd_ctx)) {
 		hdd_wma_send_fastreassoc_cmd((int)adapter->sessionId,
 					targetApBssid, (int)channel);
diff --git a/core/mac/inc/qwlan_version.h b/core/mac/inc/qwlan_version.h
index 8dcc74e..cacfdfb 100644
--- a/core/mac/inc/qwlan_version.h
+++ b/core/mac/inc/qwlan_version.h
@@ -41,9 +41,9 @@
 #define QWLAN_VERSION_MAJOR            5
 #define QWLAN_VERSION_MINOR            1
 #define QWLAN_VERSION_PATCH            0
-#define QWLAN_VERSION_EXTRA            "Z"
-#define QWLAN_VERSION_BUILD            32
+#define QWLAN_VERSION_EXTRA            "C"
+#define QWLAN_VERSION_BUILD            33
 
-#define QWLAN_VERSIONSTR               "5.1.0.32Z"
+#define QWLAN_VERSIONSTR               "5.1.0.33C"
 
 #endif /* QWLAN_VERSION_H */
diff --git a/core/mac/src/pe/lim/lim_p2p.c b/core/mac/src/pe/lim/lim_p2p.c
index 8c2318b..4109854 100644
--- a/core/mac/src/pe/lim/lim_p2p.c
+++ b/core/mac/src/pe/lim/lim_p2p.c
@@ -407,10 +407,11 @@
 	return;
 }
 
-QDF_STATUS lim_p2p_action_cnf(tpAniSirGlobal pMac, uint32_t txCompleteSuccess)
+QDF_STATUS lim_p2p_action_cnf(tpAniSirGlobal pMac, uint32_t tx_status)
 {
 	QDF_STATUS status;
 	uint32_t mgmt_frame_sessionId;
+	bool tx_complete_ack = (tx_status) ? false : true;
 
 	status = pe_acquire_global_lock(&pMac->lim);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
@@ -429,7 +430,7 @@
 					 mgmt_frame_sessionId);
 			if (pMac->p2p_ack_ind_cb)
 				pMac->p2p_ack_ind_cb(mgmt_frame_sessionId,
-							txCompleteSuccess);
+						     tx_complete_ack);
 		}
 	}
 
diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c
index 6ba0531..9c96837 100644
--- a/core/sap/src/sap_ch_select.c
+++ b/core/sap/src/sap_ch_select.c
@@ -1879,6 +1879,7 @@
 	return eSAP_FALSE;
 }
 
+#ifdef FEATURE_WLAN_CH_AVOID
 /**
  * sap_select_channel_no_scan_result() - select SAP channel when no scan results
  * are available.
@@ -1887,26 +1888,17 @@
  * Returns: channel number if success, 0 otherwise
  */
 static uint8_t sap_select_channel_no_scan_result(tHalHandle hal,
-						ptSapContext sap_ctx)
+						 ptSapContext sap_ctx)
 {
-	uint32_t start_ch_num, end_ch_num;
-#ifdef FEATURE_WLAN_CH_AVOID
 	enum channel_state ch_type;
 	uint8_t i, first_safe_ch_in_range = SAP_CHANNEL_NOT_SELECTED;
-#endif
 	uint32_t dfs_master_cap_enabled;
-	start_ch_num = sap_ctx->acs_cfg->start_ch;
-	end_ch_num = sap_ctx->acs_cfg->end_ch;
+	uint32_t start_ch_num = sap_ctx->acs_cfg->start_ch;
+	uint32_t end_ch_num = sap_ctx->acs_cfg->end_ch;
 
 	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
 		  FL("start - end: %d - %d"), start_ch_num, end_ch_num);
 
-#ifndef FEATURE_WLAN_CH_AVOID
-	sap_ctx->acs_cfg->pri_ch = start_ch_num;
-	sap_ctx->acs_cfg->ht_sec_ch = 0;
-	/* pick the first channel in configured range */
-	return start_ch_num;
-#else
 	sme_cfg_get_int(hal, WNI_CFG_DFS_MASTER_ENABLED,
 				&dfs_master_cap_enabled);
 
@@ -1962,8 +1954,25 @@
 
 	/* if no channel selected return SAP_CHANNEL_NOT_SELECTED */
 	return first_safe_ch_in_range;
-#endif /* !FEATURE_WLAN_CH_AVOID */
 }
+#else
+static uint8_t sap_select_channel_no_scan_result(tHalHandle hal,
+						 ptSapContext sap_ctx)
+{
+	uint32_t start_ch_num = sap_ctx->acs_cfg->start_ch;
+
+	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
+		  FL("start - end: %d - %d"),
+		  start_ch_num,
+		  sap_ctx->acs_cfg->end_ch);
+
+	sap_ctx->acs_cfg->pri_ch = start_ch_num;
+	sap_ctx->acs_cfg->ht_sec_ch = 0;
+
+	/* pick the first channel in configured range */
+	return start_ch_num;
+}
+#endif /* FEATURE_WLAN_CH_AVOID */
 
 /**
  * sap_select_channel() - select SAP channel
diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c
index 25f2eb3..54a3dce 100644
--- a/core/sap/src/sap_fsm.c
+++ b/core/sap/src/sap_fsm.c
@@ -4460,7 +4460,7 @@
 	uint8_t end_ch_num, band_end_ch;
 	uint32_t en_lte_coex;
 	tHalHandle hal = CDS_GET_HAL_CB(sap_ctx->p_cds_gctx);
-#if defined(FEATURE_WLAN_CH_AVOID) || defined(SOFTAP_CHANNEL_RANGE)
+#ifdef FEATURE_WLAN_CH_AVOID
 	uint8_t i;
 #endif
 	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c
index 784477f..547ae03 100644
--- a/core/sme/src/csr/csr_api_roam.c
+++ b/core/sme/src/csr/csr_api_roam.c
@@ -17541,14 +17541,14 @@
 			= (uint8_t *) &mac_ctx->rrm.rrmPEContext.rrmEnabledCaps;
 	uint8_t power_cap_ie_data[DOT11F_IE_POWERCAPS_MAX_LEN]
 			= {MIN_TX_PWR_CAP, MAX_TX_PWR_CAP};
-	uint8_t max_tx_pwr_cap
-			= csr_get_cfg_max_tx_power(mac_ctx,
-				session->pConnectBssDesc->channelId);
-
+	uint8_t max_tx_pwr_cap = 0;
 	uint8_t supp_chan_ie[DOT11F_IE_SUPPCHANNELS_MAX_LEN], supp_chan_ie_len;
 	uint8_t ese_ie[DOT11F_IE_ESEVERSION_MAX_LEN]
 			= { 0x0, 0x40, 0x96, 0x3, ESE_VERSION_SUPPORTED};
 
+	if (session->pConnectBssDesc)
+		max_tx_pwr_cap = csr_get_cfg_max_tx_power(mac_ctx,
+				session->pConnectBssDesc->channelId);
 	if (max_tx_pwr_cap)
 		power_cap_ie_data[1] = max_tx_pwr_cap;
 
@@ -17661,11 +17661,13 @@
 	/*
 	 * The Dynamic Config Items Update may happen even if the state is in
 	 * INIT. It is important to ensure that the command is passed down to
-	 * the FW only if the Infra Station is in a connected state.A connected
-	 * station could also be in a PREAUTH or REASSOC states.So, consider not
-	 * sending the command down in INIT state. We also have to ensure that
-	 * if there is a STOP command we always have to inform Riva,
-	 * irrespective of whichever state we are in
+	 * the FW only if the Infra Station is in a connected state. A connected
+	 * station could also be in a PREAUTH or REASSOC states.
+	 * 1) Block all CMDs that are not STOP in INIT State. For STOP always
+	 *    inform firmware irrespective of state.
+	 * 2) Block update cfg CMD if its for REASON_ROAM_SET_BLACKLIST_BSSID,
+	 *    because we need to inform firmware of blacklisted AP for PNO in
+	 *    all states.
 	 */
 
 	if ((roam_info->neighborRoamState ==