Browse Source

qcacld-3.0: Update set disable channel list command implementation

Currently driver disables channels received in
SET_DISABLE_CHANNEL_LIST command, only when sap is turned
on (on start bss). According to new requirement, channels
should be disabled as soon as the command is received.

To meet above expectation, update the set disable channel list
command functionality to disable the channels as soon as the
command is received.

CRs-fixed: 2424991
Change-Id: I596c21847e90efef9676f20df528aed77e927519
Ashish Kumar Dhanotiya 6 years ago
parent
commit
dd5f74c00b
3 changed files with 41 additions and 28 deletions
  1. 9 28
      core/hdd/src/wlan_hdd_hostapd.c
  2. 25 0
      core/hdd/src/wlan_hdd_hostapd.h
  3. 7 0
      core/hdd/src/wlan_hdd_ioctl.c

+ 9 - 28
core/hdd/src/wlan_hdd_hostapd.c

@@ -4537,7 +4537,7 @@ static int wlan_hdd_setup_driver_overrides(struct hdd_adapter *ap_adapter)
 		return 0;
 }
 
-static void hdd_check_and_disconnect_sta_on_invalid_channel(
+void hdd_check_and_disconnect_sta_on_invalid_channel(
 		struct hdd_context *hdd_ctx)
 {
 	struct hdd_adapter *sta_adapter;
@@ -4644,9 +4644,13 @@ int wlan_hdd_restore_channels(struct hdd_context *hdd_ctx,
 		 * Restore the orginal states of the channels
 		 * only if we have cached non zero values
 		 */
-		if (cache_chann->channel_info[i].wiphy_status && wiphy_channel)
-			wiphy_channel->flags =
+		wiphy_channel->flags =
 				cache_chann->channel_info[i].wiphy_status;
+
+		hdd_debug("Restore channel %d reg_stat %d wiphy_stat 0x%x",
+			  cache_chann->channel_info[i].channel_num,
+			  cache_chann->channel_info[i].reg_status,
+			  wiphy_channel->flags);
 	}
 
 	qdf_mutex_release(&hdd_ctx->cache_channel_lock);
@@ -4662,16 +4666,7 @@ int wlan_hdd_restore_channels(struct hdd_context *hdd_ctx,
 	return 0;
 }
 
-/**
- * wlan_hdd_disable_channels() - Cache the channels
- * and current state of the channels from the channel list
- * received in the command and disable the channels on the
- * wiphy and reg table.
- * @hdd_ctx: Pointer to hdd context
- *
- * Return: 0 on success, Error code on failure
- */
-static int wlan_hdd_disable_channels(struct hdd_context *hdd_ctx)
+int wlan_hdd_disable_channels(struct hdd_context *hdd_ctx)
 {
 	struct hdd_cache_channels *cache_chann;
 	struct wiphy *wiphy;
@@ -4737,7 +4732,7 @@ static int wlan_hdd_disable_channels(struct hdd_context *hdd_ctx)
 	return status;
 }
 #else
-static int wlan_hdd_disable_channels(struct hdd_context *hdd_ctx)
+int wlan_hdd_disable_channels(struct hdd_context *hdd_ctx)
 {
 	return 0;
 }
@@ -5019,18 +5014,6 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 			hdd_check_and_disconnect_sta_on_invalid_channel(
 								       hdd_ctx);
 	}
-	if (adapter->device_mode == QDF_SAP_MODE) {
-		/*
-		 * Disable the channels received in command
-		 * SET_DISABLE_CHANNEL_LIST
-		 */
-		status = wlan_hdd_disable_channels(hdd_ctx);
-		if (!QDF_IS_STATUS_SUCCESS(status))
-			hdd_err("Disable channel list fail");
-		else
-			hdd_check_and_disconnect_sta_on_invalid_channel(
-								hdd_ctx);
-	}
 
 	beacon = adapter->session.ap.beacon;
 
@@ -5674,8 +5657,6 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 	goto free;
 
 error:
-	if (adapter->device_mode == QDF_SAP_MODE)
-		wlan_hdd_restore_channels(hdd_ctx, true);
 
 	/* Revert the indoor to passive marking if START BSS fails */
 	if (indoor_chnl_marking && adapter->device_mode == QDF_SAP_MODE) {

+ 25 - 0
core/hdd/src/wlan_hdd_hostapd.h

@@ -202,4 +202,29 @@ QDF_STATUS wlan_hdd_config_acs(struct hdd_context *hdd_ctx,
 			       struct hdd_adapter *adapter);
 
 void hdd_sap_indicate_disconnect_for_sta(struct hdd_adapter *adapter);
+
+/**
+ * wlan_hdd_disable_channels() - Cache the channels
+ * and current state of the channels from the channel list
+ * received in the command and disable the channels on the
+ * wiphy and reg table.
+ * @hdd_ctx: Pointer to hdd context
+ *
+ * Return: 0 on success, Error code on failure
+ */
+int wlan_hdd_disable_channels(struct hdd_context *hdd_ctx);
+
+/*
+ * hdd_check_and_disconnect_sta_on_invalid_channel() - Disconnect STA if it is
+ * on invalid channel
+ * @hdd_ctx: pointer to hdd context
+ *
+ * STA should be disconnected before starting the SAP if it is on indoor
+ * channel.
+ *
+ * Return: void
+ */
+void hdd_check_and_disconnect_sta_on_invalid_channel(
+						struct hdd_context *hdd_ctx);
+
 #endif /* end #if !defined(WLAN_HDD_HOSTAPD_H) */

+ 7 - 0
core/hdd/src/wlan_hdd_ioctl.c

@@ -7205,6 +7205,12 @@ static int hdd_parse_disable_chan_cmd(struct hdd_adapter *adapter, uint8_t *ptr)
 mem_alloc_failed:
 
 	qdf_mutex_release(&hdd_ctx->cache_channel_lock);
+	/* Disable the channels received in command SET_DISABLE_CHANNEL_LIST */
+	if (!is_command_repeated && hdd_ctx->original_channels) {
+		wlan_hdd_disable_channels(hdd_ctx);
+		hdd_check_and_disconnect_sta_on_invalid_channel(hdd_ctx);
+	}
+
 	hdd_exit();
 
 	return ret;
@@ -7212,6 +7218,7 @@ mem_alloc_failed:
 parse_failed:
 	if (!is_command_repeated)
 		wlan_hdd_free_cache_channels(hdd_ctx);
+
 	qdf_mutex_release(&hdd_ctx->cache_channel_lock);
 	hdd_exit();