Browse Source

qcacld-3.0: Don't limit channel list to max 32 channels

qcacld-2.0 to qcacld-3.0 propagation.

In __iw_get_channel_list, driver populates valid
channel list from nv table.
Currently, the driver only populates 32 channels.
The driver should populate complete valid channel list.
Moreover, driver should not include DFS channels in channel list
if the device is not set to DFS_MASTER mode.

Fix these issues by returning all supported channels.

Change-Id: I4981941834f25b9d213c20715ca8237a4b885473
CRs-Fixed: 988849
(cherry picked from commit 7a4c5379f991bb4e72393e775f4664517d0a68aa)
Agrawal Ashish 8 years ago
parent
commit
6c9bca7802
3 changed files with 44 additions and 32 deletions
  1. 3 3
      core/hdd/inc/qc_sap_ioctl.h
  2. 40 27
      core/hdd/src/wlan_hdd_hostapd.c
  3. 1 2
      core/hdd/src/wlan_hdd_wext.c

+ 3 - 3
core/hdd/inc/qc_sap_ioctl.h

@@ -245,9 +245,9 @@ enum {
 	QCSAP_PARAM_CONC_SYSTEM_PREF
 };
 
-int iw_softap_get_channel_list(struct net_device *dev,
-			       struct iw_request_info *info,
-			       union iwreq_data *wrqu, char *extra);
+int iw_get_channel_list(struct net_device *dev,
+		struct iw_request_info *info,
+		union iwreq_data *wrqu, char *extra);
 
 #endif /* __linux__ */
 

+ 40 - 27
core/hdd/src/wlan_hdd_hostapd.c

@@ -3938,48 +3938,65 @@ static int iw_softap_set_force_acs_ch_range(struct net_device *dev,
 	return ret;
 }
 
-static int __iw_softap_get_channel_list(struct net_device *dev,
+static int __iw_get_channel_list(struct net_device *dev,
 					struct iw_request_info *info,
 					union iwreq_data *wrqu, char *extra)
 {
 	uint32_t num_channels = 0;
 	uint8_t i = 0;
-	uint8_t bandStartChannel = CHAN_ENUM_1;
-	uint8_t bandEndChannel = CHAN_ENUM_184;
-	hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
-	tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+	uint8_t band_start_channel = CHAN_ENUM_1;
+	uint8_t band_end_channel = CHAN_ENUM_184;
+	hdd_adapter_t *hostapd_adapter = (netdev_priv(dev));
+	tHalHandle hal = WLAN_HDD_GET_HAL_CTX(hostapd_adapter);
 	tpChannelListInfo channel_list = (tpChannelListInfo) extra;
-	eCsrBand curBand = eCSR_BAND_ALL;
+	eCsrBand cur_band = eCSR_BAND_ALL;
 	hdd_context_t *hdd_ctx;
 	int ret;
+	bool is_dfs_mode_enabled = false;
 
 	ENTER_DEV(dev);
 
-	hdd_ctx = WLAN_HDD_GET_CTX(pHostapdAdapter);
+	hdd_ctx = WLAN_HDD_GET_CTX(hostapd_adapter);
 	ret = wlan_hdd_validate_context(hdd_ctx);
 	if (0 != ret)
 		return ret;
 
-	if (QDF_STATUS_SUCCESS != sme_get_freq_band(hHal, &curBand)) {
+	if (QDF_STATUS_SUCCESS != sme_get_freq_band(hal, &cur_band)) {
 		hdd_err("not able get the current frequency band");
 		return -EIO;
 	}
 	wrqu->data.length = sizeof(tChannelListInfo);
 
-	if (eCSR_BAND_24 == curBand) {
-		bandStartChannel = CHAN_ENUM_1;
-		bandEndChannel = CHAN_ENUM_14;
-	} else if (eCSR_BAND_5G == curBand) {
-		bandStartChannel = CHAN_ENUM_36;
-		bandEndChannel = CHAN_ENUM_184;
+	if (eCSR_BAND_24 == cur_band) {
+		band_start_channel = CHAN_ENUM_1;
+		band_end_channel = CHAN_ENUM_14;
+	} else if (eCSR_BAND_5G == cur_band) {
+		band_start_channel = CHAN_ENUM_36;
+		band_end_channel = CHAN_ENUM_184;
+	}
+	if (cur_band != eCSR_BAND_24) {
+		if (hdd_ctx->config->dot11p_mode)
+			band_end_channel = CHAN_ENUM_184;
+		else
+			band_end_channel = CHAN_ENUM_165;
+	}
+
+	if (hostapd_adapter->device_mode == QDF_STA_MODE &&
+	    hdd_ctx->config->enableDFSChnlScan) {
+		is_dfs_mode_enabled = true;
+	} else if (hostapd_adapter->device_mode == QDF_SAP_MODE &&
+		   hdd_ctx->config->enableDFSMasterCap) {
+		is_dfs_mode_enabled = true;
 	}
 
-	hdd_notice("curBand = %d, StartChannel = %hu, EndChannel = %hu ",
-	       curBand, bandStartChannel, bandEndChannel);
+	hdd_notice("curBand = %d, StartChannel = %hu, EndChannel = %hu is_dfs_mode_enabled  = %d ",
+			cur_band, band_start_channel, band_end_channel,
+			is_dfs_mode_enabled);
 
-	for (i = bandStartChannel; i <= bandEndChannel; i++) {
+	for (i = band_start_channel; i <= band_end_channel; i++) {
 		if ((CHANNEL_STATE_ENABLE == CDS_CHANNEL_STATE(i)) ||
-		    (CHANNEL_STATE_DFS == CDS_CHANNEL_STATE(i))) {
+			(is_dfs_mode_enabled &&
+		     CHANNEL_STATE_DFS == CDS_CHANNEL_STATE(i))) {
 			channel_list->channels[num_channels] =
 				CDS_CHANNEL_NUM(i);
 			num_channels++;
@@ -3988,24 +4005,20 @@ static int __iw_softap_get_channel_list(struct net_device *dev,
 
 	hdd_notice(" number of channels %d", num_channels);
 
-	if (num_channels > IW_MAX_FREQUENCIES) {
-		num_channels = IW_MAX_FREQUENCIES;
-	}
-
 	channel_list->num_channels = num_channels;
 	EXIT();
 
 	return 0;
 }
 
-int iw_softap_get_channel_list(struct net_device *dev,
-			       struct iw_request_info *info,
-			       union iwreq_data *wrqu, char *extra)
+int iw_get_channel_list(struct net_device *dev,
+		struct iw_request_info *info,
+		union iwreq_data *wrqu, char *extra)
 {
 	int ret;
 
 	cds_ssr_protect(__func__);
-	ret = __iw_softap_get_channel_list(dev, info, wrqu, extra);
+	ret = __iw_get_channel_list(dev, info, wrqu, extra);
 	cds_ssr_unprotect(__func__);
 
 	return ret;
@@ -5600,7 +5613,7 @@ static const iw_handler hostapd_private[] = {
 	[QCSAP_IOCTL_MODIFY_ACL - SIOCIWFIRSTPRIV] =
 		iw_softap_modify_acl,
 	[QCSAP_IOCTL_GET_CHANNEL_LIST - SIOCIWFIRSTPRIV] =
-		iw_softap_get_channel_list,
+		iw_get_channel_list,
 	[QCSAP_IOCTL_GET_STA_INFO - SIOCIWFIRSTPRIV] =
 		iw_softap_get_sta_info,
 	[QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED -

+ 1 - 2
core/hdd/src/wlan_hdd_wext.c

@@ -7266,8 +7266,7 @@ static int __iw_get_char_setnone(struct net_device *dev,
 		tChannelListInfo channel_list;
 
 		memset(&channel_list, 0, sizeof(channel_list));
-		status =
-			iw_softap_get_channel_list(dev, info, wrqu,
+		status = iw_get_channel_list(dev, info, wrqu,
 						   (char *)&channel_list);
 		if (!QDF_IS_STATUS_SUCCESS(status)) {
 			hdd_err("GetChannelList Failed!!!");