Browse Source

qcacld-3.0: Set max BW for each valid channel and send to FW

Configuration for Issue:-
DUT configuration:-
1. Configure DUT's country as US where channel 165 does
not support channel bandwidth of 40 mhz.
AP Configuration:-
1 Configure the AP in a country where channel 165
supports channel bandwidth 40MHZ.

Scenario of the issue:-
1.Connect to a diff AP on some channel x with same SSID,
and then roam to this AP.

Observation:-
The DUT would connect in 40 mhz to this AP instead of 20Mhz,
which violates the DUT's country reg rules.

Expectation:-
The DUT should re-connect only in 20Mhz on channel 165, or
only in max BW supported by reg in that country.

Issue:-
The DUT does not consider the max bandwidth allowed for the channel
in the country configured, and allow the re-association only
in the respective bandwidth.

Fix:-
Send the max BW supported by the channels in the current
reg domain to the FW so that it considers the max BW of the
channel and AP capability and then roam in the respective BW
only.

Change-Id: I1730d6c65d3dd305dcf2ebe340c3d5ad950761d7
CRs-Fixed: 2504900
gaurank kathpalia 5 years ago
parent
commit
821a5aea98
1 changed files with 36 additions and 3 deletions
  1. 36 3
      core/wma/src/wma_scan_roam.c

+ 36 - 3
core/wma/src/wma_scan_roam.c

@@ -88,6 +88,32 @@
 #define WMA_EXTSCAN_MAX_HOTLIST_ENTRIES 10
 #endif
 
+static inline wmi_host_channel_width
+wma_map_phy_ch_bw_to_wmi_channel_width(enum phy_ch_width ch_width)
+{
+	switch (ch_width) {
+	case CH_WIDTH_20MHZ:
+		return WMI_HOST_CHAN_WIDTH_20;
+	case CH_WIDTH_40MHZ:
+		return WMI_HOST_CHAN_WIDTH_40;
+	case CH_WIDTH_80MHZ:
+		return WMI_HOST_CHAN_WIDTH_80;
+	case CH_WIDTH_160MHZ:
+		return WMI_HOST_CHAN_WIDTH_160;
+	case CH_WIDTH_5MHZ:
+		return WMI_HOST_CHAN_WIDTH_5;
+	case CH_WIDTH_10MHZ:
+		return WMI_HOST_CHAN_WIDTH_10;
+	default:
+		return WMI_HOST_CHAN_WIDTH_20;
+	}
+}
+
+#define WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ      0
+#define WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ         1
+#define WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ        2
+#define WNI_CFG_VHT_CHANNEL_WIDTH_80_PLUS_80MHZ 3
+
 /**
  * wma_update_channel_list() - update channel list
  * @handle: wma handle
@@ -105,6 +131,8 @@ QDF_STATUS wma_update_channel_list(WMA_HANDLE handle,
 	int i, len;
 	struct scan_chan_list_params *scan_ch_param;
 	struct channel_param *chan_p;
+	uint16_t channel;
+	struct ch_params ch_params;
 
 	len = sizeof(struct channel_param) * chan_list->numChan +
 		offsetof(struct scan_chan_list_params, ch_param[0]);
@@ -124,9 +152,9 @@ QDF_STATUS wma_update_channel_list(WMA_HANDLE handle,
 		chan_p->mhz = chan_list->chanParam[i].freq;
 		chan_p->cfreq1 = chan_p->mhz;
 		chan_p->cfreq2 = 0;
-		wma_handle->saved_chan.channel_list[i] =
-			wlan_reg_freq_to_chan(wma_handle->pdev,
-					      chan_list->chanParam[i].freq);
+		channel = wlan_reg_freq_to_chan(wma_handle->pdev,
+						chan_list->chanParam[i].freq);
+		wma_handle->saved_chan.channel_list[i] = channel;
 
 		WMA_LOGD("chan[%d] = freq:%u DFS:%d tx power:%d",
 			 i, chan_p->mhz,
@@ -164,6 +192,11 @@ QDF_STATUS wma_update_channel_list(WMA_HANDLE handle,
 		/*TODO: WMI_SET_CHANNEL_REG_CLASSID */
 		chan_p->maxregpower = chan_list->chanParam[i].pwr;
 
+		ch_params.ch_width = CH_WIDTH_160MHZ;
+		wlan_reg_set_channel_params(wma_handle->pdev, channel, 0,
+					    &ch_params);
+		chan_p->max_bw_supported =
+		     wma_map_phy_ch_bw_to_wmi_channel_width(ch_params.ch_width);
 		chan_p++;
 	}