qcacld-3.0: Check the channel width value in CSA processing

Check the channel width value in CSA IE before we process the
channel switch so that if the AP sends the wrong channel width in
CSA driver can process with correct configuration

Change-Id: Ib14a0146502b0f731f319ac1fe6657a389388cec
CRs-Fixed: 2162235
diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
index a02ed29..10c6755 100644
--- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
+++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -2130,7 +2130,8 @@
 
 	if (session_entry->vhtCapability &&
 			session_entry->htSupportedChannelWidthSet) {
-		if (csa_params->ies_present_flag & lim_wbw_ie_present) {
+		if (csa_params->ies_present_flag & lim_wbw_ie_present &&
+				csa_params->new_ch_width) {
 			lim_process_csa_wbw_ie(mac_ctx, csa_params,
 					chnl_switch_info, session_entry);
 			lim_ch_switch->sec_ch_offset =
@@ -2185,6 +2186,18 @@
 			lim_ch_switch->sec_ch_offset =
 				ch_params.sec_ch_offset;
 
+		} else {
+			lim_ch_switch->state =
+				eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+			ch_params.ch_width = CH_WIDTH_40MHZ;
+			wlan_reg_set_channel_params(mac_ctx->pdev,
+					csa_params->channel, 0, &ch_params);
+			lim_ch_switch->sec_ch_offset =
+				ch_params.sec_ch_offset;
+			chnl_switch_info->newChanWidth = CH_WIDTH_40MHZ;
+			chnl_switch_info->newCenterChanFreq0 =
+				ch_params.center_freq_seg0;
+			chnl_switch_info->newCenterChanFreq1 = 0;
 		}
 		session_entry->gLimChannelSwitch.ch_center_freq_seg0 =
 			chnl_switch_info->newCenterChanFreq0;