Browse Source

qcacld-3.0: Add support for SRD channels in ETSI domain

Add support for SRD channels in ETSI regulatory domain

1) Add SRD channels only if DSRC feature is disabled.
2) Add user configuration to enable/disable these channels
in master mode PCL/ACS. Default is disabled.
3) Allow these channels in ACS/PCL only if the INI is set.

Change-Id: Ibd79dc95e9911ce3a0fd101f4716d9bbb8b75466
CRs-Fixed: 2264786
Kiran Kumar Lokere 6 years ago
parent
commit
1a43bcf236

+ 25 - 0
core/hdd/inc/wlan_hdd_cfg.h

@@ -9002,6 +9002,30 @@ enum dot11p_mode {
 #define CFG_DOT11P_MODE_MIN              (WLAN_HDD_11P_DISABLED)
 #define CFG_DOT11P_MODE_MAX              (WLAN_HDD_11P_CONCURRENT)
 
+/*
+ * <ini>
+ * etsi13_srd_chan_in_master_mode - Enable/disable ETSI SRD channels in
+ * master mode PCL and ACS functionality
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * etsi13_srd_chan_in_master_mode is to enable/disable ETSI SRD channels in
+ * master mode PCL and ACS functionality
+ *
+ * Related: None
+ *
+ * Supported Feature: SAP/P2P-GO
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE    "etsi13_srd_chan_in_master_mode"
+#define CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE_DEF (0)
+#define CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE_MIN (0)
+#define CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE_MAX (1)
+
 /*
  * <ini>
  * gEnable_go_cts2self_for_sta - Indicate firmware to stop NOA and
@@ -14845,6 +14869,7 @@ struct hdd_config {
 	bool fastpath_enable;
 #endif
 	uint8_t dot11p_mode;
+	bool etsi13_srd_chan_in_master_mode;
 	uint8_t rx_mode;
 	uint32_t ce_service_max_yield_time;
 	uint8_t ce_service_max_rx_ind_flush;

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

@@ -3510,6 +3510,13 @@ struct reg_table_entry g_registry_table[] = {
 		     CFG_DOT11P_MODE_MIN,
 		     CFG_DOT11P_MODE_MAX),
 
+	REG_VARIABLE(CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE, WLAN_PARAM_Integer,
+		     struct hdd_config, etsi13_srd_chan_in_master_mode,
+		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		     CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE_DEF,
+		     CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE_MIN,
+		     CFG_ETSI13_SRD_CHAN_IN_MASTER_MODE_MAX),
+
 #ifdef FEATURE_WLAN_EXTSCAN
 	REG_VARIABLE(CFG_EXTSCAN_ALLOWED_NAME, WLAN_PARAM_Integer,
 		     struct hdd_config, extscan_enabled,

+ 110 - 42
core/hdd/src/wlan_hdd_cfg80211.c

@@ -250,6 +250,7 @@ static const struct ieee80211_channel hdd_channels_5_ghz[] = {
 	HDD5GHZCHAN(5825, 165, 0),
 };
 
+#ifdef WLAN_FEATURE_DSRC
 static const struct ieee80211_channel hdd_channels_dot11p[] = {
 	HDD5GHZCHAN(5852, 170, 0),
 	HDD5GHZCHAN(5855, 171, 0),
@@ -267,6 +268,12 @@ static const struct ieee80211_channel hdd_channels_dot11p[] = {
 	HDD5GHZCHAN(5915, 183, 0),
 	HDD5GHZCHAN(5920, 184, 0),
 };
+#else
+static const struct ieee80211_channel hdd_etsi13_srd_ch[] = {
+	HDD5GHZCHAN(5845, 169, 0),
+	HDD5GHZCHAN(5865, 173, 0),
+};
+#endif
 
 static struct ieee80211_rate g_mode_rates[] = {
 	HDD_G_MODE_RATETAB(10, 0x1, 0),
@@ -1631,11 +1638,11 @@ static int wlan_hdd_set_acs_ch_range(
 	} else if (hw_mode == QCA_ACS_MODE_IEEE80211A) {
 		sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11a;
 		sap_cfg->acs_cfg.start_ch = WLAN_REG_CH_NUM(CHAN_ENUM_36);
-		sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_165);
+		sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_173);
 	} else if (hw_mode == QCA_ACS_MODE_IEEE80211ANY) {
 		sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_abg;
 		sap_cfg->acs_cfg.start_ch = WLAN_REG_CH_NUM(CHAN_ENUM_1);
-		sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_165);
+		sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_173);
 	}
 
 	if (ht_enabled)
@@ -2356,7 +2363,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
 	tsap_config_t *sap_config;
 	struct sk_buff *temp_skbuff;
-	int ret, i;
+	int ret, i, ch_cnt = 0;
 	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ACS_MAX + 1];
 	bool ht_enabled, ht40_enabled, vht_enabled;
 	uint8_t ch_width;
@@ -2364,6 +2371,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 	QDF_STATUS qdf_status;
 	uint8_t conc_channel;
 	mac_handle_t mac_handle;
+	bool skip_etsi13_srd_chan = false;
 
 	/* ***Note*** Donot set SME config related to ACS operation here because
 	 * ACS operation is not synchronouse and ACS for Second AP may come when
@@ -2536,6 +2544,22 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		goto out;
 	}
 
+	skip_etsi13_srd_chan =
+		!hdd_ctx->config->etsi13_srd_chan_in_master_mode &&
+		wlan_reg_is_etsi13_regdmn(hdd_ctx->hdd_pdev);
+
+	if (skip_etsi13_srd_chan) {
+		for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) {
+			if (wlan_reg_is_etsi13_srd_chan(hdd_ctx->hdd_pdev,
+							sap_config->acs_cfg.
+							ch_list[i]))
+				sap_config->acs_cfg.ch_list[i] = 0;
+			else
+				sap_config->acs_cfg.ch_list[ch_cnt++] =
+						sap_config->acs_cfg.ch_list[i];
+		}
+		sap_config->acs_cfg.ch_list_count = ch_cnt;
+	}
 	hdd_debug("get pcl for DO_ACS vendor command");
 
 	/* consult policy manager to get PCL */
@@ -14972,6 +14996,60 @@ static void wlan_hdd_cfg80211_set_dfs_offload_feature(struct wiphy *wiphy)
 }
 #endif
 
+#ifdef WLAN_FEATURE_DSRC
+static void wlan_hdd_get_num_dsrc_ch_and_len(struct hdd_config *hdd_cfg,
+					     int *num_ch, int *ch_len)
+{
+	*num_ch = QDF_ARRAY_SIZE(hdd_channels_dot11p);
+	*ch_len = sizeof(hdd_channels_dot11p);
+}
+
+static void wlan_hdd_copy_dsrc_ch(char *ch_ptr, int ch_arr_len)
+{
+	if (!ch_arr_len)
+		return;
+	qdf_mem_copy(ch_ptr, &hdd_channels_dot11p[0], ch_arr_len);
+}
+
+static void wlan_hdd_get_num_srd_ch_and_len(struct hdd_config *hdd_cfg,
+					    int *num_ch, int *ch_len)
+{
+	*num_ch = 0;
+	*ch_len = 0;
+}
+
+static void wlan_hdd_copy_srd_ch(char *ch_ptr, int ch_arr_len)
+{
+}
+
+#else
+
+static void wlan_hdd_get_num_dsrc_ch_and_len(struct hdd_config *hdd_cfg,
+					     int *num_ch, int *ch_len)
+{
+	*num_ch = 0;
+	*ch_len = 0;
+}
+
+static void wlan_hdd_copy_dsrc_ch(char *ch_ptr, int ch_arr_len)
+{
+}
+
+static void wlan_hdd_get_num_srd_ch_and_len(struct hdd_config *hdd_cfg,
+					    int *num_ch, int *ch_len)
+{
+	*num_ch = QDF_ARRAY_SIZE(hdd_etsi13_srd_ch);
+	*ch_len = sizeof(hdd_etsi13_srd_ch);
+}
+
+static void wlan_hdd_copy_srd_ch(char *ch_ptr, int ch_arr_len)
+{
+	if (!ch_arr_len)
+		return;
+	qdf_mem_copy(ch_ptr, &hdd_etsi13_srd_ch[0], ch_arr_len);
+}
+#endif
+
 /*
  * FUNCTION: wlan_hdd_cfg80211_init
  * This function is called by hdd_wlan_startup()
@@ -14983,7 +15061,8 @@ int wlan_hdd_cfg80211_init(struct device *dev,
 {
 	int i, j;
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
-	int len = 0;
+	int len_5g_ch = 0, num_ch, ch_arr_size;
+	int num_dsrc_ch, len_dsrc_ch, num_srd_ch, len_srd_ch;
 	uint32_t *cipher_suites;
 
 	hdd_enter();
@@ -15107,41 +15186,30 @@ int wlan_hdd_cfg80211_init(struct device *dev,
 		 (eHDD_DOT11_MODE_11b_ONLY != pCfg->dot11Mode) &&
 		 (eHDD_DOT11_MODE_11g_ONLY != pCfg->dot11Mode))) {
 		wiphy->bands[HDD_NL80211_BAND_5GHZ] = &wlan_hdd_band_5_ghz;
-
-		if (pCfg->dot11p_mode) {
-			wiphy->bands[HDD_NL80211_BAND_5GHZ]->channels =
-				qdf_mem_malloc(sizeof(hdd_channels_5_ghz) +
-						sizeof(hdd_channels_dot11p));
-			if (wiphy->bands[HDD_NL80211_BAND_5GHZ]->channels ==
-								NULL) {
-				goto mem_fail;
-			}
-			wiphy->bands[HDD_NL80211_BAND_5GHZ]->n_channels =
-					QDF_ARRAY_SIZE(hdd_channels_5_ghz) +
-					QDF_ARRAY_SIZE(hdd_channels_dot11p);
-
-			qdf_mem_copy(wiphy->bands[HDD_NL80211_BAND_5GHZ]->
-					channels, &hdd_channels_5_ghz[0],
-					sizeof(hdd_channels_5_ghz));
-			len = sizeof(hdd_channels_5_ghz);
-			qdf_mem_copy((char *)wiphy->
-					bands[HDD_NL80211_BAND_5GHZ]->channels
-						+ len,
-						&hdd_channels_dot11p[0],
-					sizeof(hdd_channels_dot11p));
-
-		} else {
-			wiphy->bands[HDD_NL80211_BAND_5GHZ]->channels =
-			qdf_mem_malloc(sizeof(hdd_channels_5_ghz));
-			if (wiphy->bands[HDD_NL80211_BAND_5GHZ]->channels ==
-								NULL) {
-				goto mem_fail;
-			}
-			qdf_mem_copy(wiphy->
-				bands[HDD_NL80211_BAND_5GHZ]->channels,
-				&hdd_channels_5_ghz[0],
-				sizeof(hdd_channels_5_ghz));
-		}
+		wlan_hdd_get_num_dsrc_ch_and_len(pCfg, &num_dsrc_ch,
+						 &len_dsrc_ch);
+		wlan_hdd_get_num_srd_ch_and_len(pCfg, &num_srd_ch, &len_srd_ch);
+		num_ch = QDF_ARRAY_SIZE(hdd_channels_5_ghz) + num_dsrc_ch +
+			 num_srd_ch;
+		len_5g_ch = sizeof(hdd_channels_5_ghz);
+		ch_arr_size = len_5g_ch + len_dsrc_ch + len_srd_ch;
+
+		wiphy->bands[HDD_NL80211_BAND_5GHZ]->channels =
+			qdf_mem_malloc(ch_arr_size);
+		if (!wiphy->bands[HDD_NL80211_BAND_5GHZ]->channels)
+			goto mem_fail;
+		wiphy->bands[HDD_NL80211_BAND_5GHZ]->n_channels = num_ch;
+
+		qdf_mem_copy(wiphy->bands[HDD_NL80211_BAND_5GHZ]->channels,
+			     &hdd_channels_5_ghz[0], len_5g_ch);
+		if (num_dsrc_ch)
+			wlan_hdd_copy_dsrc_ch((char *)wiphy->bands[
+					      HDD_NL80211_BAND_5GHZ]->channels +
+					      len_5g_ch, len_dsrc_ch);
+		if (num_srd_ch)
+			wlan_hdd_copy_srd_ch((char *)wiphy->bands[
+					     HDD_NL80211_BAND_5GHZ]->channels +
+					     len_5g_ch, len_srd_ch);
 	}
 
 	for (i = 0; i < HDD_NUM_NL80211_BANDS; i++) {
@@ -15644,7 +15712,7 @@ QDF_STATUS wlan_hdd_validate_operation_channel(struct hdd_adapter *adapter,
 
 	if (hdd_pConfig_ini->sapAllowAllChannel) {
 		/* Validate the channel */
-		for (count = CHAN_ENUM_1; count <= CHAN_ENUM_165; count++) {
+		for (count = CHAN_ENUM_1; count <= CHAN_ENUM_173; count++) {
 			if (channel == WLAN_REG_CH_NUM(count)) {
 				fValidChannel = true;
 				break;
@@ -22347,8 +22415,8 @@ void wlan_hdd_init_chan_info(struct hdd_context *hdd_ctx)
 
 	num_5g = QDF_ARRAY_SIZE(hdd_channels_5_ghz);
 	for (; (index - num_2g) < num_5g; index++) {
-		if (WLAN_REG_IS_11P_CH(
-			    hdd_channels_5_ghz[index - num_2g].hw_value))
+		if (wlan_reg_is_dsrc_chan(hdd_ctx->hdd_pdev,
+		    hdd_channels_5_ghz[index - num_2g].hw_value))
 			continue;
 		hdd_ctx->chan_info[index].freq =
 			hdd_channels_5_ghz[index - num_2g].center_freq;

+ 4 - 2
core/hdd/src/wlan_hdd_ext_scan.c

@@ -2381,8 +2381,10 @@ static void hdd_remove_dsrc_channels(struct hdd_context *hdd_ctx,
 	int i;
 
 	for (i = 0; i < *num_channels; i++) {
-		if (!WLAN_REG_IS_11P_CH(wlan_reg_freq_to_chan(hdd_ctx->hdd_pdev,
-							      chan_list[i]))) {
+		if (!wlan_reg_is_dsrc_chan(hdd_ctx->hdd_pdev,
+					   wlan_reg_freq_to_chan(
+					   hdd_ctx->hdd_pdev,
+					   chan_list[i]))) {
 			chan_list[num_chan_temp] = chan_list[i];
 			num_chan_temp++;
 		}

+ 4 - 8
core/hdd/src/wlan_hdd_hostapd_wext.c

@@ -1932,7 +1932,7 @@ static int __iw_get_channel_list(struct net_device *dev,
 	uint32_t num_channels = 0;
 	uint8_t i = 0;
 	uint8_t band_start_channel = CHAN_ENUM_1;
-	uint8_t band_end_channel = CHAN_ENUM_184;
+	uint8_t band_end_channel = MAX_5GHZ_CHANNEL;
 	struct hdd_adapter *hostapd_adapter = (netdev_priv(dev));
 	struct channel_list_info *channel_list =
 					(struct channel_list_info *) extra;
@@ -1964,15 +1964,11 @@ static int __iw_get_channel_list(struct net_device *dev,
 		band_end_channel = CHAN_ENUM_14;
 	} else if (BAND_5G == cur_band) {
 		band_start_channel = CHAN_ENUM_36;
-		band_end_channel = CHAN_ENUM_184;
+		band_end_channel = MAX_5GHZ_CHANNEL;
 	}
 
-	if (cur_band != BAND_2G) {
-		if (hdd_ctx->config->dot11p_mode)
-			band_end_channel = CHAN_ENUM_184;
-		else
-			band_end_channel = CHAN_ENUM_173;
-	}
+	if (cur_band != BAND_2G)
+		band_end_channel = MAX_5GHZ_CHANNEL;
 
 	if (hostapd_adapter->device_mode == QDF_STA_MODE &&
 	    hdd_ctx->config->enableDFSChnlScan) {

+ 5 - 1
core/hdd/src/wlan_hdd_main.c

@@ -10256,15 +10256,19 @@ static int hdd_features_init(struct hdd_context *hdd_ctx)
 	struct sme_5g_band_pref_params band_pref_params;
 	int ret;
 	mac_handle_t mac_handle;
+	struct hdd_config *cfg;
 
 	hdd_enter();
 
+	cfg = hdd_ctx->config;
 	/* FW capabilities received, Set the Dot11 mode */
 	mac_handle = hdd_ctx->mac_handle;
 	sme_setdef_dot11mode(mac_handle);
 	sme_set_prefer_80MHz_over_160MHz(mac_handle,
 			hdd_ctx->config->sta_prefer_80MHz_over_160MHz);
-
+	sme_set_etsi13_srd_ch_in_master_mode(mac_handle,
+					     cfg->
+					     etsi13_srd_chan_in_master_mode);
 
 	if (hdd_ctx->config->fIsImpsEnabled)
 		hdd_set_idle_ps_config(hdd_ctx, true);

+ 2 - 2
core/hdd/src/wlan_hdd_oemdata.c

@@ -403,8 +403,8 @@ void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx,
 			cds_chan_to_freq(ch_params.center_freq_seg0);
 
 	if (ch_params.ch_width < CH_WIDTH_INVALID)
-		phy_mode = wma_chan_phy_mode(chan,
-				ch_params.ch_width, wni_dot11_mode);
+		phy_mode = wma_chan_phy_mode(chan, ch_params.ch_width,
+					     wni_dot11_mode);
 	else
 		/*
 		 * If channel width is CH_WIDTH_INVALID, It mean channel is

+ 2 - 0
core/hdd/src/wlan_hdd_regulatory.c

@@ -219,6 +219,8 @@ static void reg_program_config_vars(struct hdd_context *hdd_ctx,
 	config_vars->band_capability = hdd_ctx->config->nBandCapability;
 	config_vars->restart_beaconing = hdd_ctx->config->
 		restart_beaconing_on_chan_avoid_event;
+	config_vars->enable_srd_chan_in_master_mode =
+		hdd_ctx->config->etsi13_srd_chan_in_master_mode;
 }
 
 

+ 1 - 1
core/mac/inc/wni_cfg.h

@@ -506,7 +506,7 @@ enum {
 #define WNI_CFG_LISTEN_INTERVAL_STADEF    1
 
 #define WNI_CFG_CURRENT_CHANNEL_STAMIN    0
-#define WNI_CFG_CURRENT_CHANNEL_STAMAX    165
+#define WNI_CFG_CURRENT_CHANNEL_STAMAX    173
 #define WNI_CFG_CURRENT_CHANNEL_STADEF    1
 
 #define WNI_CFG_RATE_ADAPTATION_TYPE_FIXED    0

+ 1 - 1
core/mac/src/pe/lim/lim_process_tdls.c

@@ -251,7 +251,7 @@ static void populate_dot11f_tdls_offchannel_params(
 				validChan[i], nss_5g, nss_2g);
 			continue;
 		} else {
-			if (WLAN_REG_IS_11P_CH(validChan[i])) {
+			if (wlan_reg_is_dsrc_chan(pMac->pdev, validChan[i])) {
 				pe_debug("skipping channel: %d from the valid channel list",
 					validChan[i]);
 				continue;

+ 1 - 0
core/sap/inc/sap_api.h

@@ -736,6 +736,7 @@ typedef struct tagSapStruct {
 #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
 	bool acs_with_more_param;
 	bool enable_dfs_phy_error_logs;
+	bool enable_etsi13_srd_chan_support;
 } tSapStruct, *tpSapStruct;
 
 typedef struct sap_SoftapStats_s {

+ 10 - 4
core/sap/src/sap_ch_select.c

@@ -157,6 +157,8 @@ sapSafeChannelType safe_channels[NUM_CHANNELS] = {
 	{157, true},
 	{161, true},
 	{165, true},
+	{169, true},
+	{173, true},
 };
 #endif
 
@@ -689,7 +691,11 @@ static bool sap_chan_sel_init(tHalHandle halHandle,
 		}
 
 		/* Skip DSRC channels */
-		if (WLAN_REG_IS_11P_CH(*pChans))
+		if (wlan_reg_is_dsrc_chan(pMac->pdev, *pChans))
+			continue;
+
+		if (!pMac->sap.enable_etsi13_srd_chan_support &&
+		    wlan_reg_is_etsi13_srd_chan(pMac->pdev, *pChans))
 			continue;
 
 		if (true == chSafe) {
@@ -2112,7 +2118,7 @@ static void sap_sort_chl_weight_vht160(tSapChSelSpectInfo *pSpectInfoParams)
 
 	/*
 	 * Assign max weight(SAP_ACS_WEIGHT_MAX * 8) to 2.4 Ghz channels
-	 * and channel 132-165 as they cannot be part of a 160Mhz channel
+	 * and channel 132-173 as they cannot be part of a 160Mhz channel
 	 * bonding.
 	 */
 	pSpectInfo = pSpectInfoParams->pSpectCh;
@@ -2120,7 +2126,7 @@ static void sap_sort_chl_weight_vht160(tSapChSelSpectInfo *pSpectInfoParams)
 		if ((pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_1) &&
 		     pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_14)) ||
 		    (pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_132) &&
-		     pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_165)))
+		     pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_173)))
 			pSpectInfo[j].weight = SAP_ACS_WEIGHT_MAX * 8;
 	}
 
@@ -2181,7 +2187,7 @@ static void sap_allocate_max_weight_ht40_5_g(
 	spect_info = spect_info_params->pSpectCh;
 	for (j = 0; j < spect_info_params->numSpectChans; j++) {
 		if ((spect_info[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_36) &&
-		     spect_info[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_165)))
+		     spect_info[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_173)))
 			spect_info[j].weight = SAP_ACS_WEIGHT_MAX * 2;
 	}
 }

+ 14 - 2
core/sap/src/sap_fsm.c

@@ -3350,10 +3350,14 @@ static QDF_STATUS sap_get_channel_list(struct sap_context *sap_ctx,
 		 * - DFS scan disable but chan in CHANNEL_STATE_ENABLE
 		 */
 		if (!(((true == mac_ctx->scan.fEnableDFSChnlScan) &&
-		      wlan_reg_get_channel_state(mac_ctx->pdev, loop_count)) ||
+		      wlan_reg_get_channel_state(mac_ctx->pdev,
+						 WLAN_REG_CH_NUM(loop_count)))
+		      ||
 		    ((false == mac_ctx->scan.fEnableDFSChnlScan) &&
 		     (CHANNEL_STATE_ENABLE ==
-		      wlan_reg_get_channel_state(mac_ctx->pdev, loop_count)))))
+		      wlan_reg_get_channel_state(mac_ctx->pdev,
+						 WLAN_REG_CH_NUM(loop_count)))
+		     )))
 			continue;
 
 		/*
@@ -3375,6 +3379,14 @@ static QDF_STATUS sap_get_channel_list(struct sap_context *sap_ctx,
 		    WLAN_REG_CH_NUM(loop_count)))
 			continue;
 
+		/* Dont scan ETSI13 SRD channels if the ETSI13 SRD channels
+		 * are not enabled in master mode
+		 */
+		if (!wlan_reg_is_etsi13_srd_chan_allowed_master_mode(mac_ctx->
+								     pdev) &&
+		    wlan_reg_is_etsi13_srd_chan(mac_ctx->pdev,
+						WLAN_REG_CH_NUM(loop_count)))
+			continue;
 		/*
 		 * If we have any 5Ghz channel in the channel list
 		 * and bw is 40/80/160 Mhz then we don't want SAP to

+ 10 - 6
core/sap/src/sap_module.c

@@ -2323,18 +2323,22 @@ void wlansap_extend_to_acs_range(tHalHandle hal, uint8_t *startChannelNum,
 				 (*endChannelNum + ACS_2G_EXTEND) : 14;
 	} else if (*startChannelNum >= 36 && *endChannelNum >= 36) {
 		*bandStartChannel = CHAN_ENUM_36;
-		*bandEndChannel = CHAN_ENUM_165;
+		*bandEndChannel = CHAN_ENUM_173;
 		tmp_startChannelNum = (*startChannelNum - ACS_5G_EXTEND) > 36 ?
 				   (*startChannelNum - ACS_5G_EXTEND) : 36;
-		tmp_endChannelNum = (*endChannelNum + ACS_5G_EXTEND) <= 165 ?
-				 (*endChannelNum + ACS_5G_EXTEND) : 165;
+		tmp_endChannelNum = (*endChannelNum + ACS_5G_EXTEND) <=
+				     WNI_CFG_CURRENT_CHANNEL_STAMAX ?
+				     (*endChannelNum + ACS_5G_EXTEND) :
+				     WNI_CFG_CURRENT_CHANNEL_STAMAX;
 	} else {
 		*bandStartChannel = CHAN_ENUM_1;
-		*bandEndChannel = CHAN_ENUM_165;
+		*bandEndChannel = CHAN_ENUM_173;
 		tmp_startChannelNum = *startChannelNum > 5 ?
 			(*startChannelNum - ACS_2G_EXTEND) : 1;
-		tmp_endChannelNum = (*endChannelNum + ACS_5G_EXTEND) <= 165 ?
-			(*endChannelNum + ACS_5G_EXTEND) : 165;
+		tmp_endChannelNum = (*endChannelNum + ACS_5G_EXTEND) <=
+				     WNI_CFG_CURRENT_CHANNEL_STAMAX ?
+				     (*endChannelNum + ACS_5G_EXTEND) :
+				     WNI_CFG_CURRENT_CHANNEL_STAMAX;
 	}
 
 	/* Note if the ACS range include only DFS channels, do not cross range

+ 18 - 0
core/sme/inc/sme_api.h

@@ -1197,6 +1197,11 @@ QDF_STATUS sme_register_for_dcc_stats_event(tHalHandle hHal, void *context,
 					    ocb_callback callback);
 QDF_STATUS sme_deregister_for_dcc_stats_event(tHalHandle hHal);
 
+static inline void
+sme_set_etsi13_srd_ch_in_master_mode(tHalHandle hal,
+				     bool etsi13_srd_chan_support)
+{
+}
 #else
 static inline void sme_set_dot11p_config(tHalHandle hal, bool enable_dot11p)
 {
@@ -1271,7 +1276,20 @@ static inline QDF_STATUS sme_deregister_for_dcc_stats_event(tHalHandle hHal)
 {
 	return QDF_STATUS_SUCCESS;
 }
+
+/**
+ * sme_set_etsi13_srd_ch_in_master_mode() - master mode UNI-III band ch support
+ * @hal: HAL pointer
+ * @srd_chan_support: ETSI SRD channel support
+ *
+ * This function set master ETSI SRD channel support
+ *
+ * Return: None
+ */
+void sme_set_etsi13_srd_ch_in_master_mode(tHalHandle hal,
+					  bool etsi13_srd_chan_support);
 #endif
+
 void sme_add_set_thermal_level_callback(tHalHandle hal,
 		sme_set_thermal_level_callback callback);
 

+ 10 - 0
core/sme/src/common/sme_api.c

@@ -9373,6 +9373,16 @@ QDF_STATUS sme_deregister_for_dcc_stats_event(tHalHandle h_hal)
 
 	return status;
 }
+#else
+void sme_set_etsi13_srd_ch_in_master_mode(tHalHandle hal,
+					  bool etsi13_srd_chan_support)
+{
+	tpAniSirGlobal mac;
+
+	mac = PMAC_STRUCT(hal);
+	mac->sap.enable_etsi13_srd_chan_support = etsi13_srd_chan_support;
+	sme_debug("srd_ch_support %d", mac->sap.enable_etsi13_srd_chan_support);
+}
 #endif
 
 void sme_get_recovery_stats(tHalHandle hHal)

+ 3 - 3
core/sme/src/csr/csr_api_roam.c

@@ -1035,8 +1035,8 @@ QDF_STATUS csr_update_channel_list(tpAniSirGlobal pMac)
 			continue;
 
 		/* Scan is not performed on DSRC channels*/
-		if (pScan->base_channels.channelList[i] >=
-		    WLAN_REG_MIN_11P_CH_NUM)
+		if (wlan_reg_is_dsrc_chan(pMac->pdev,
+					  pScan->base_channels.channelList[i]))
 			continue;
 
 		channel = pScan->base_channels.channelList[i];
@@ -13561,7 +13561,7 @@ QDF_STATUS csr_get_cfg_valid_channels(tpAniSirGlobal pMac, uint8_t *pChannels,
 		return QDF_STATUS_E_FAILURE;
 
 	for (i = 0; i < *pNumChan; i++) {
-		if (!WLAN_REG_IS_11P_CH(pChannels[i])) {
+		if (!wlan_reg_is_dsrc_chan(pMac->pdev, pChannels[i])) {
 			pChannels[num_chan_temp] = pChannels[i];
 			num_chan_temp++;
 		}

+ 1 - 1
core/wma/inc/wma.h

@@ -2268,7 +2268,7 @@ QDF_STATUS wma_get_cca_stats(tp_wma_handle wma_handle,
 
 struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma_handle);
 WLAN_PHY_MODE wma_chan_phy_mode(u8 chan, enum phy_ch_width chan_width,
-	u8 dot11_mode);
+				u8 dot11_mode);
 
 #ifdef FEATURE_OEM_DATA_SUPPORT
 QDF_STATUS wma_start_oem_data_req(tp_wma_handle wma_handle,

+ 2 - 1
core/wma/src/wma_features.c

@@ -666,6 +666,7 @@ WLAN_PHY_MODE wma_chan_phy_mode(u8 chan, enum phy_ch_width chan_width,
 {
 	WLAN_PHY_MODE phymode = MODE_UNKNOWN;
 	uint16_t bw_val = wlan_reg_get_bw_value(chan_width);
+	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
 
 	if (WLAN_REG_IS_24GHZ_CH(chan)) {
 		if (((CH_WIDTH_5MHZ == chan_width) ||
@@ -717,7 +718,7 @@ WLAN_PHY_MODE wma_chan_phy_mode(u8 chan, enum phy_ch_width chan_width,
 				break;
 			}
 		}
-	} else if (WLAN_REG_IS_11P_CH(chan))
+	} else if (wlan_reg_is_dsrc_chan(wma->pdev, chan))
 		phymode = MODE_11A;
 	else {
 		if (((CH_WIDTH_5MHZ == chan_width) ||