Browse Source

qcacmn: Add API to pass configuration settings

Add API to pass initial configuration settings to
regulatory component.The regulatory component would
re-compute initialization channel list when this API
is called.

Change-Id: I414ecd189c0879515bd9b3f07537b3143a5cb0ed
CRs-Fixed: 2002892
Amar Singhal 8 years ago
parent
commit
9749753a75

+ 4 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h

@@ -173,6 +173,8 @@ typedef void (*wlan_objmgr_peer_status_handler)(
  * @WLAN_ATF_ID:                Airtime Fairness operations
  * @WLAN_CRYPTO_ID:             Crypto service operation
  * @WLAN_NAN_ID:                nan operations
+ * @WLAN_REGULATORY_SB_ID:      SB regulatory operations
+ * @WLAN_REGULATORY_NB_ID:      NB regulatory operations
  * @WLAN_REF_ID_MAX:            Max id used to generate ref count tracking array
  */
 typedef enum {
@@ -197,6 +199,8 @@ typedef enum {
 	WLAN_ATF_ID           = 18,
 	WLAN_CRYPTO_ID        = 19,
 	WLAN_NAN_ID           = 20,
+	WLAN_REGULATORY_SB_ID = 21,
+	WLAN_REGULATORY_NB_ID = 22,
 	WLAN_REF_ID_MAX,
 } wlan_objmgr_ref_dbgid;
 

+ 6 - 2
umac/regulatory/core/src/reg_priv.h

@@ -55,7 +55,7 @@ struct wlan_regulatory_psoc_priv_obj {
 	uint32_t phybitmap;
 	enum dfs_reg dfs_region;
 	char country_11d[REG_ALPHA2_LEN + 1];
-	bool dfs_disabled;
+	bool dfs_enabled;
 	bool set_fcc_channel;
 	enum band_info band_capability;
 	bool indoor_chan_enabled;
@@ -67,7 +67,11 @@ struct wlan_regulatory_psoc_priv_obj {
 struct wlan_regulatory_pdev_priv_obj {
 	struct regulatory_channel cur_chan_list[NUM_CHANNELS];
 	struct wlan_objmgr_pdev *pdev_ptr;
-	bool dfs_disabled;
+	uint32_t range_2g_low;
+	uint32_t range_2g_high;
+	uint32_t range_5g_low;
+	uint32_t range_5g_high;
+	bool dfs_enabled;
 	bool set_fcc_channel;
 	enum band_info band_capability;
 	bool indoor_chan_enabled;

+ 227 - 48
umac/regulatory/core/src/reg_services.c

@@ -119,6 +119,21 @@ const struct chan_map channel_map[NUM_CHANNELS] = {
 	[CHAN_ENUM_161] = {5805, 161},
 	[CHAN_ENUM_165] = {5825, 165},
 
+	[CHAN_ENUM_170] = {5852, 170},
+	[CHAN_ENUM_171] = {5855, 171},
+	[CHAN_ENUM_172] = {5860, 172},
+	[CHAN_ENUM_173] = {5865, 173},
+	[CHAN_ENUM_174] = {5870, 174},
+	[CHAN_ENUM_175] = {5875, 175},
+	[CHAN_ENUM_176] = {5880, 176},
+	[CHAN_ENUM_177] = {5885, 177},
+	[CHAN_ENUM_178] = {5890, 178},
+	[CHAN_ENUM_179] = {5895, 179},
+	[CHAN_ENUM_180] = {5900, 180},
+	[CHAN_ENUM_181] = {5905, 181},
+	[CHAN_ENUM_182] = {5910, 182},
+	[CHAN_ENUM_183] = {5915, 183},
+	[CHAN_ENUM_184] = {5920, 184},
 };
 
 
@@ -834,12 +849,6 @@ void reg_set_dfs_region(struct wlan_objmgr_psoc *psoc,
 	soc_reg->dfs_region = dfs_reg;
 }
 
-/**
- * reg_get_domain_from_country_code() - get the regulatory domain
- * @reg_domain_ptr: ptr to store regulatory domain
- *
- * Return: QDF_STATUS
- */
 QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
 					    const uint8_t *country_alpha2,
 					    enum country_src source)
@@ -916,19 +925,6 @@ enum band_info reg_chan_to_band(uint32_t chan_num)
 
 }
 
-
-/**
- * reg_dmn_get_chanwidth_from_opclass() - return chan width based on opclass
- * @country: country name
- * @channel: operating channel
- * @opclass: operating class
- *
- * Given a value of country, channel and opclass this API will return value of
- * channel width.
- *
- * Return: channel width
- *
- */
 uint16_t reg_dmn_get_chanwidth_from_opclass(uint8_t *country,
 					    uint8_t channel,
 					    uint8_t opclass)
@@ -962,14 +958,6 @@ uint16_t reg_dmn_get_chanwidth_from_opclass(uint8_t *country,
 }
 
 
-/**
- * reg_dmn_get_opclass_from_channel() - get operating class from channel
- * @country: the complete reg domain
- * @channel: channel number
- * @offset: the value of offset
- *
- * Return: operating class
- */
 uint16_t reg_dmn_get_opclass_from_channel(uint8_t *country, uint8_t channel,
 					  uint8_t offset)
 {
@@ -1000,13 +988,6 @@ uint16_t reg_dmn_get_opclass_from_channel(uint8_t *country, uint8_t channel,
 	return 0;
 }
 
-/**
- * reg_dmn_set_curr_opclasses() - set the current operating class
- * @num_classes: number of classes
- * @class: operating class
- *
- * Return: error code
- */
 uint16_t reg_dmn_set_curr_opclasses(uint8_t num_classes, uint8_t *class)
 {
 	uint8_t i;
@@ -1024,13 +1005,6 @@ uint16_t reg_dmn_set_curr_opclasses(uint8_t num_classes, uint8_t *class)
 	return 0;
 }
 
-/**
- * reg_dmn_get_curr_opclasses() - get the current operating class
- * @num_classes: number of classes
- * @class: operating class
- *
- * Return: error code
- */
 uint16_t reg_dmn_get_curr_opclasses(uint8_t *num_classes, uint8_t *class)
 {
 	uint8_t i;
@@ -1049,7 +1023,6 @@ uint16_t reg_dmn_get_curr_opclasses(uint8_t *num_classes, uint8_t *class)
 }
 
 
-
 static void reg_fill_channel_info(enum channel_enum chan_enum,
 				  struct cur_reg_rule *reg_rule,
 				  struct regulatory_channel *master_list,
@@ -1255,9 +1228,9 @@ QDF_STATUS wlan_regulatory_psoc_obj_created_notification(
 		return QDF_STATUS_E_NOMEM;
 	}
 
-	soc_reg_obj->offload_enabled  = false;
+	soc_reg_obj->offload_enabled = false;
 	soc_reg_obj->psoc_ptr = psoc;
-	soc_reg_obj->dfs_disabled = false;
+	soc_reg_obj->dfs_enabled = true;
 	soc_reg_obj->set_fcc_channel = false;
 	soc_reg_obj->band_capability = BAND_ALL;
 	soc_reg_obj->indoor_chan_enabled = true;
@@ -1331,11 +1304,11 @@ QDF_STATUS wlan_regulatory_psoc_obj_destroyed_notification(
 
 static void
 modify_chan_list_for_dfs_channels(struct regulatory_channel *chan_list,
-				  bool dfs_disabled)
+				  bool dfs_enabled)
 {
 	enum channel_enum chan_enum;
 
-	if (!dfs_disabled)
+	if (dfs_enabled)
 		return;
 
 	for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
@@ -1541,7 +1514,7 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification(
 	}
 
 	pdev_priv_obj->pdev_ptr = pdev;
-	pdev_priv_obj->dfs_disabled = psoc_priv_obj->dfs_disabled;
+	pdev_priv_obj->dfs_enabled = psoc_priv_obj->dfs_enabled;
 	pdev_priv_obj->set_fcc_channel = psoc_priv_obj->set_fcc_channel;
 	pdev_priv_obj->band_capability =  psoc_priv_obj->band_capability;
 	pdev_priv_obj->indoor_chan_enabled =
@@ -1556,7 +1529,7 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification(
 			psoc_priv_obj->nol_chan[chan_enum];
 
 	modify_chan_list_for_dfs_channels(pdev_priv_obj->cur_chan_list,
-					  pdev_priv_obj->dfs_disabled);
+					  pdev_priv_obj->dfs_enabled);
 
 	modify_chan_list_for_indoor_channels(pdev_priv_obj->cur_chan_list,
 					 pdev_priv_obj->indoor_chan_enabled);
@@ -1592,6 +1565,11 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification(
 	range_5g_low = reg_cap_ptr->low_5ghz_chan;
 	range_5g_high = reg_cap_ptr->high_5ghz_chan;
 
+	pdev_priv_obj->range_2g_low = range_2g_low;
+	pdev_priv_obj->range_2g_high = range_2g_high;
+	pdev_priv_obj->range_5g_low = range_5g_low;
+	pdev_priv_obj->range_5g_high = range_5g_high;
+
 	modify_chan_list_for_freq_range(pdev_priv_obj->cur_chan_list,
 					range_2g_low, range_2g_high,
 					range_5g_low, range_5g_high);
@@ -1730,6 +1708,88 @@ void reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
 	}
 }
 
+static void reg_change_pdev_for_config(struct wlan_objmgr_psoc *psoc,
+				  void *object, void *arg)
+{
+	struct wlan_objmgr_pdev *pdev = (struct wlan_objmgr_pdev *)object;
+	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+
+	wlan_psoc_obj_lock(psoc);
+	psoc_priv_obj = (struct wlan_regulatory_psoc_priv_obj *)
+		wlan_objmgr_psoc_get_comp_private_obj(psoc,
+				       WLAN_UMAC_COMP_REGULATORY);
+	wlan_psoc_obj_unlock(psoc);
+
+	if (NULL == psoc_priv_obj) {
+		reg_err("psoc priv obj is NULL");
+		return;
+	}
+
+	wlan_pdev_obj_lock(pdev);
+	pdev_priv_obj = (struct wlan_regulatory_pdev_priv_obj *)
+		wlan_objmgr_pdev_get_comp_private_obj(pdev,
+					       WLAN_UMAC_COMP_REGULATORY);
+	wlan_pdev_obj_unlock(pdev);
+
+	if (NULL == pdev_priv_obj) {
+		reg_err("pdev priv obj is NULL");
+		return;
+	}
+
+	pdev_priv_obj->dfs_enabled =
+		psoc_priv_obj->dfs_enabled;
+	pdev_priv_obj->indoor_chan_enabled =
+		psoc_priv_obj->indoor_chan_enabled;
+	pdev_priv_obj->band_capability = psoc_priv_obj->band_capability;
+
+	modify_chan_list_for_dfs_channels(pdev_priv_obj->cur_chan_list,
+					  pdev_priv_obj->dfs_enabled);
+
+	modify_chan_list_for_indoor_channels(pdev_priv_obj->cur_chan_list,
+					 pdev_priv_obj->indoor_chan_enabled);
+
+	modify_chan_list_for_band(pdev_priv_obj->cur_chan_list,
+				  pdev_priv_obj->band_capability);
+}
+
+QDF_STATUS reg_set_config_vars(struct wlan_objmgr_psoc *psoc,
+			    struct reg_config_vars config_vars)
+{
+	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
+	QDF_STATUS status;
+
+	wlan_psoc_obj_lock(psoc);
+	psoc_priv_obj = (struct wlan_regulatory_psoc_priv_obj *)
+		wlan_objmgr_psoc_get_comp_private_obj(psoc,
+				       WLAN_UMAC_COMP_REGULATORY);
+	wlan_psoc_obj_unlock(psoc);
+
+	if (NULL == psoc_priv_obj) {
+		reg_err("psoc priv obj is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	psoc_priv_obj->enable_11d_supp_original =
+		config_vars.enable_11d_support;
+	psoc_priv_obj->enable_11d_supp_current =
+		config_vars.enable_11d_support;
+	psoc_priv_obj->userspace_country_priority =
+		config_vars.userspace_ctry_priority;
+	psoc_priv_obj->dfs_enabled =
+		config_vars.dfs_enabled;
+	psoc_priv_obj->indoor_chan_enabled =
+		config_vars.indoor_chan_enabled;
+	psoc_priv_obj->band_capability = config_vars.band_capability;
+
+	status = wlan_objmgr_iterate_obj_list(psoc, WLAN_PDEV_OP,
+					      reg_change_pdev_for_config,
+					      NULL, 1, WLAN_REGULATORY_SB_ID);
+
+	return status;
+}
+
+
 bool reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan)
 {
 	enum channel_state ch_state;
@@ -1803,3 +1863,122 @@ uint32_t reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, uint32_t chan_num)
 
 	return 0;
 }
+
+bool reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
+
+	wlan_psoc_obj_lock(psoc);
+	psoc_priv_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
+					WLAN_UMAC_COMP_REGULATORY);
+	wlan_psoc_obj_unlock(psoc);
+
+	if (NULL == psoc_priv_obj) {
+		reg_err("reg psoc private obj is NULL");
+		return false;
+	}
+
+	return psoc_priv_obj->offload_enabled;
+}
+
+
+static void reg_change_pdev_for_new_mas_chan_list(struct wlan_objmgr_psoc *psoc,
+						  void *object, void *arg)
+{
+	struct wlan_objmgr_pdev *pdev = (struct wlan_objmgr_pdev *)object;
+	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+	enum channel_enum chan_enum;
+
+	wlan_psoc_obj_lock(psoc);
+	psoc_priv_obj = (struct wlan_regulatory_psoc_priv_obj *)
+		wlan_objmgr_psoc_get_comp_private_obj(psoc,
+				       WLAN_UMAC_COMP_REGULATORY);
+	wlan_psoc_obj_unlock(psoc);
+
+	if (NULL == psoc_priv_obj) {
+		reg_err("psoc priv obj is NULL");
+		return;
+	}
+
+	wlan_pdev_obj_lock(pdev);
+	pdev_priv_obj = (struct wlan_regulatory_pdev_priv_obj *)
+		wlan_objmgr_pdev_get_comp_private_obj(pdev,
+					       WLAN_UMAC_COMP_REGULATORY);
+	wlan_pdev_obj_unlock(pdev);
+
+	if (NULL == pdev_priv_obj) {
+		reg_err("pdev priv obj is NULL");
+		return;
+	}
+
+	qdf_mem_copy(pdev_priv_obj->cur_chan_list,
+		     psoc_priv_obj->mas_chan_list,
+		     NUM_CHANNELS * sizeof(struct regulatory_channel));
+
+	for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++)
+		pdev_priv_obj->cur_chan_list[chan_enum].nol_chan =
+			psoc_priv_obj->nol_chan[chan_enum];
+
+	modify_chan_list_for_freq_range(pdev_priv_obj->cur_chan_list,
+					pdev_priv_obj->range_2g_low,
+					pdev_priv_obj->range_2g_high,
+					pdev_priv_obj->range_5g_low,
+					pdev_priv_obj->range_5g_high);
+
+	modify_chan_list_for_dfs_channels(pdev_priv_obj->cur_chan_list,
+					  pdev_priv_obj->dfs_enabled);
+
+	modify_chan_list_for_indoor_channels(pdev_priv_obj->cur_chan_list,
+					 pdev_priv_obj->indoor_chan_enabled);
+
+	modify_chan_list_for_band(pdev_priv_obj->cur_chan_list,
+				  pdev_priv_obj->band_capability);
+
+	modify_chan_list_for_nol_list(pdev_priv_obj->cur_chan_list);
+
+	modify_chan_list_for_fcc_channel(pdev_priv_obj->cur_chan_list,
+					 pdev_priv_obj->set_fcc_channel);
+
+}
+
+void reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc,
+				    struct regulatory_channel *reg_channels,
+				    uint8_t *alpha2,
+				    enum dfs_reg dfs_region)
+{
+
+	struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
+	QDF_STATUS status;
+	uint32_t count;
+
+	wlan_psoc_obj_lock(psoc);
+	psoc_priv_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
+					WLAN_UMAC_COMP_REGULATORY);
+	wlan_psoc_obj_unlock(psoc);
+
+	if (NULL == psoc_priv_obj) {
+		reg_err("reg psoc private obj is NULL");
+		return;
+	}
+
+	psoc_priv_obj->dfs_region = dfs_region;
+	qdf_mem_copy(psoc_priv_obj->default_country, alpha2,
+		     REG_ALPHA2_LEN);
+
+	for (count = 0; count < NUM_CHANNELS; count++) {
+		reg_channels[count].chan_num =
+			channel_map[count].chan_num;
+		reg_channels[count].center_freq =
+			channel_map[count].center_freq;
+	}
+
+	qdf_mem_copy(psoc_priv_obj->mas_chan_list,
+		     reg_channels,
+		     NUM_CHANNELS * sizeof(struct regulatory_channel));
+
+	status = wlan_objmgr_iterate_obj_list(psoc, WLAN_PDEV_OP,
+				     reg_change_pdev_for_new_mas_chan_list,
+				     NULL, 1, WLAN_REGULATORY_SB_ID);
+
+}

+ 213 - 152
umac/regulatory/core/src/reg_services.h

@@ -35,27 +35,28 @@
 #include "reg_db.h"
 #include <reg_services_public_struct.h>
 
-#define REG_MAX_CHANNELS_PER_OPERATING_CLASS  25
-#define REG_MAX_SUPP_OPER_CLASSES 32
-
 #define REG_MIN_24GHZ_CH_NUM channel_map[MIN_24GHZ_CHANNEL].chan_num
 #define REG_MAX_24GHZ_CH_NUM channel_map[MAX_24GHZ_CHANNEL].chan_num
 #define REG_MIN_5GHZ_CH_NUM channel_map[MIN_5GHZ_CHANNEL].chan_num
 #define REG_MAX_5GHZ_CH_NUM channel_map[MAX_5GHZ_CHANNEL].chan_num
+#define REG_MIN_11P_CH_NUM channel_map[MIN_11P_CHANNEL].chan_num
+#define REG_MAX_11P_CH_NUM channel_map[MAX_11P_CHANNEL].chan_num
+
+#define REG_IS_24GHZ_CH(chan_num) \
+	((chan_num >= REG_MIN_24GHZ_CH_NUM) &&	\
+	 (chan_num <= REG_MAX_24GHZ_CH_NUM))
 
 #define REG_IS_5GHZ_CH(chan_num) \
 	((chan_num >= REG_MIN_5GHZ_CH_NUM) &&	\
 	 (chan_num <= REG_MAX_5GHZ_CH_NUM))
 
-#define REG_IS_24GHZ_CH(chan_num) \
-	((chan_num >= REG_MIN_24GHZ_CH_NUM) &&	\
-	 (chan_num <= REG_MAX_24GHZ_CH_NUM))
+#define REG_IS_11P_CH(chan_num) \
+	((chan_num >= REG_MIN_11P_CH_NUM) &&	\
+	 (chan_num <= REG_MAX_11P_CH_NUM))
 
 #define REG_CH_NUM(ch_enum) channel_map[ch_enum].chan_num
 #define REG_CH_TO_FREQ(ch_enum) channel_map[ch_enum].center_freq
 
-#define REG_SBS_SEPARATION_THRESHOLD 100
-
 #define REG_IS_CHANNEL_VALID_5G_SBS(curchan, newchan)	\
 	(curchan > newchan ?				\
 	 REG_CH_TO_FREQ(reg_get_chan_enum(curchan))	\
@@ -65,6 +66,154 @@
 	 - REG_CH_TO_FREQ(reg_get_chan_enum(curchan))	\
 	 > REG_SBS_SEPARATION_THRESHOLD)
 
+
+#define REG_SBS_SEPARATION_THRESHOLD 100
+#define REG_MAX_CHANNELS_PER_OPERATING_CLASS  25
+#define REG_MAX_SUPP_OPER_CLASSES 32
+
+/**
+ * enum channel_enum - channel enumeration
+ * @CHAN_ENUM_1:  channel number 1
+ * @CHAN_ENUM_2:  channel number 2
+ * @CHAN_ENUM_3:  channel number 3
+ * @CHAN_ENUM_4:  channel number 4
+ * @CHAN_ENUM_5:  channel number 5
+ * @CHAN_ENUM_6:  channel number 6
+ * @CHAN_ENUM_7:  channel number 7
+ * @CHAN_ENUM_8:  channel number 8
+ * @CHAN_ENUM_9:  channel number 9
+ * @CHAN_ENUM_10:  channel number 10
+ * @CHAN_ENUM_11:  channel number 11
+ * @CHAN_ENUM_12:  channel number 12
+ * @CHAN_ENUM_13:  channel number 13
+ * @CHAN_ENUM_14:  channel number 14
+ * @CHAN_ENUM_183:  channel number 183
+ * @CHAN_ENUM_184:  channel number 184
+ * @CHAN_ENUM_185:  channel number 185
+ * @CHAN_ENUM_187:  channel number 187
+ * @CHAN_ENUM_188:  channel number 188
+ * @CHAN_ENUM_189:  channel number 189
+ * @CHAN_ENUM_192:  channel number 192
+ * @CHAN_ENUM_196:  channel number 196
+ * @CHAN_ENUM_36:  channel number 36
+ * @CHAN_ENUM_40:  channel number 40
+ * @CHAN_ENUM_44:  channel number 44
+ * @CHAN_ENUM_48:  channel number 48
+ * @CHAN_ENUM_52:  channel number 52
+ * @CHAN_ENUM_56:  channel number 56
+ * @CHAN_ENUM_60:  channel number 60
+ * @CHAN_ENUM_64:  channel number 64
+ * @CHAN_ENUM_100:  channel number 100
+ * @CHAN_ENUM_104:  channel number 104
+ * @CHAN_ENUM_108:  channel number 108
+ * @CHAN_ENUM_112:  channel number 112
+ * @CHAN_ENUM_116:  channel number 116
+ * @CHAN_ENUM_120:  channel number 120
+ * @CHAN_ENUM_124:  channel number 124
+ * @CHAN_ENUM_128:  channel number 128
+ * @CHAN_ENUM_132:  channel number 132
+ * @CHAN_ENUM_136:  channel number 136
+ * @CHAN_ENUM_140:  channel number 140
+ * @CHAN_ENUM_144:  channel number 144
+ * @CHAN_ENUM_149:  channel number 149
+ * @CHAN_ENUM_153:  channel number 153
+ * @CHAN_ENUM_157:  channel number 157
+ * @CHAN_ENUM_161:  channel number 161
+ * @CHAN_ENUM_165:  channel number 165
+ * @CHAN_ENUM_170:  channel number 170
+ * @CHAN_ENUM_171:  channel number 171
+ * @CHAN_ENUM_172:  channel number 172
+ * @CHAN_ENUM_173:  channel number 173
+ * @CHAN_ENUM_174:  channel number 174
+ * @CHAN_ENUM_175:  channel number 175
+ * @CHAN_ENUM_176:  channel number 176
+ * @CHAN_ENUM_177:  channel number 177
+ * @CHAN_ENUM_178:  channel number 178
+ * @CHAN_ENUM_179:  channel number 179
+ * @CHAN_ENUM_180:  channel number 180
+ * @CHAN_ENUM_181:  channel number 181
+ * @CHAN_ENUM_182:  channel number 182
+ * @CHAN_ENUM_183:  channel number 183
+ * @CHAN_ENUM_184:  channel number 184
+ */
+enum channel_enum {
+	CHAN_ENUM_1,
+	CHAN_ENUM_2,
+	CHAN_ENUM_3,
+	CHAN_ENUM_4,
+	CHAN_ENUM_5,
+	CHAN_ENUM_6,
+	CHAN_ENUM_7,
+	CHAN_ENUM_8,
+	CHAN_ENUM_9,
+	CHAN_ENUM_10,
+	CHAN_ENUM_11,
+	CHAN_ENUM_12,
+	CHAN_ENUM_13,
+	CHAN_ENUM_14,
+
+	CHAN_ENUM_36,
+	CHAN_ENUM_40,
+	CHAN_ENUM_44,
+	CHAN_ENUM_48,
+	CHAN_ENUM_52,
+	CHAN_ENUM_56,
+	CHAN_ENUM_60,
+	CHAN_ENUM_64,
+
+	CHAN_ENUM_100,
+	CHAN_ENUM_104,
+	CHAN_ENUM_108,
+	CHAN_ENUM_112,
+	CHAN_ENUM_116,
+	CHAN_ENUM_120,
+	CHAN_ENUM_124,
+	CHAN_ENUM_128,
+	CHAN_ENUM_132,
+	CHAN_ENUM_136,
+	CHAN_ENUM_140,
+	CHAN_ENUM_144,
+
+	CHAN_ENUM_149,
+	CHAN_ENUM_153,
+	CHAN_ENUM_157,
+	CHAN_ENUM_161,
+	CHAN_ENUM_165,
+
+	CHAN_ENUM_170,
+	CHAN_ENUM_171,
+	CHAN_ENUM_172,
+	CHAN_ENUM_173,
+	CHAN_ENUM_174,
+	CHAN_ENUM_175,
+	CHAN_ENUM_176,
+	CHAN_ENUM_177,
+	CHAN_ENUM_178,
+	CHAN_ENUM_179,
+	CHAN_ENUM_180,
+	CHAN_ENUM_181,
+	CHAN_ENUM_182,
+	CHAN_ENUM_183,
+	CHAN_ENUM_184,
+
+	NUM_CHANNELS,
+
+	MIN_24GHZ_CHANNEL = CHAN_ENUM_1,
+	MAX_24GHZ_CHANNEL = CHAN_ENUM_14,
+	NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),
+
+	MIN_5GHZ_CHANNEL = CHAN_ENUM_36,
+	MAX_5GHZ_CHANNEL = CHAN_ENUM_184,
+	NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1),
+
+	MIN_11P_CHANNEL = CHAN_ENUM_170,
+	MAX_11P_CHANNEL = CHAN_ENUM_184,
+	NUM_11P_CHANNELS = (MAX_11P_CHANNEL - MIN_11P_CHANNEL + 1),
+
+	INVALID_CHANNEL = 0xBAD,
+};
+
+
 /**
  * enum channel_state - channel state
  * @CHANNEL_STATE_DISABLE: disabled state
@@ -81,6 +230,23 @@ enum channel_state {
 	CHANNEL_STATE_INVALID,
 };
 
+/**
+ * enum reg_domain: reg domain
+ * @REGDOMAIN_FCC: FCC domain
+ * @REGDOMAIN_ETSI: ETSI domain
+ * @REGDOMAIN_JAPAN: JAPAN domain
+ * @REGDOMAIN_WORLD: WORLD domain
+ * @REGDOMAIN_COUNT: Max domain
+ */
+typedef enum {
+	REGDOMAIN_FCC,
+	REGDOMAIN_ETSI,
+	REGDOMAIN_JAPAN,
+	REGDOMAIN_WORLD,
+	REGDOMAIN_COUNT
+} v_REGDOMAIN_t;
+
+
 /**
  * enum phy_ch_width - channel width
  * @CH_WIDTH_20MHZ: 20 mhz width
@@ -119,28 +285,6 @@ struct ch_params {
 	uint8_t center_freq_seg1;
 };
 
-/**
- * struct regulatory_channel
- * @center_freq: center frequency
- * @chan_num: channel number
- * @state: channel state
- * @chan_flags: channel flags
- * @tx_power: TX powers
- * @min_bw: min bandwidth
- * @max_bw: max bandwidth
- * @nol_chan: whether channel is nol
- */
-struct regulatory_channel {
-	uint32_t center_freq;
-	uint32_t chan_num;
-	enum channel_state state;
-	uint32_t chan_flags;
-	uint32_t tx_power;
-	uint16_t min_bw;
-	uint16_t max_bw;
-	bool nol_chan;
-};
-
 /**
  * struct channel_power
  * @chan_num: channel number
@@ -191,22 +335,6 @@ struct reg_dmn_supp_op_classes {
 	uint8_t classes[REG_MAX_SUPP_OPER_CLASSES];
 };
 
-/**
- * enum reg_domain: reg domain
- * @REGDOMAIN_FCC: FCC domain
- * @REGDOMAIN_ETSI: ETSI domain
- * @REGDOMAIN_JAPAN: JAPAN domain
- * @REGDOMAIN_WORLD: WORLD domain
- * @REGDOMAIN_COUNT: Max domain
- */
-typedef enum {
-	REGDOMAIN_FCC,
-	REGDOMAIN_ETSI,
-	REGDOMAIN_JAPAN,
-	REGDOMAIN_WORLD,
-	REGDOMAIN_COUNT
-} v_REGDOMAIN_t;
-
 /**
  * enum country_src: country source
  * @SOURCE_QUERY: source query
@@ -225,112 +353,28 @@ enum country_src {
 };
 
 /**
- * enum channel_enum - channel enumeration
- * @CHAN_ENUM_1:  channel number 1
- * @CHAN_ENUM_2:  channel number 2
- * @CHAN_ENUM_3:  channel number 3
- * @CHAN_ENUM_4:  channel number 4
- * @CHAN_ENUM_5:  channel number 5
- * @CHAN_ENUM_6:  channel number 6
- * @CHAN_ENUM_7:  channel number 7
- * @CHAN_ENUM_8:  channel number 8
- * @CHAN_ENUM_9:  channel number 9
- * @CHAN_ENUM_10:  channel number 10
- * @CHAN_ENUM_11:  channel number 11
- * @CHAN_ENUM_12:  channel number 12
- * @CHAN_ENUM_13:  channel number 13
- * @CHAN_ENUM_14:  channel number 14
- * @CHAN_ENUM_183:  channel number 183
- * @CHAN_ENUM_184:  channel number 184
- * @CHAN_ENUM_185:  channel number 185
- * @CHAN_ENUM_187:  channel number 187
- * @CHAN_ENUM_188:  channel number 188
- * @CHAN_ENUM_189:  channel number 189
- * @CHAN_ENUM_192:  channel number 192
- * @CHAN_ENUM_196:  channel number 196
- * @CHAN_ENUM_36:  channel number 36
- * @CHAN_ENUM_40:  channel number 40
- * @CHAN_ENUM_44:  channel number 44
- * @CHAN_ENUM_48:  channel number 48
- * @CHAN_ENUM_52:  channel number 52
- * @CHAN_ENUM_56:  channel number 56
- * @CHAN_ENUM_60:  channel number 60
- * @CHAN_ENUM_64:  channel number 64
- * @CHAN_ENUM_100:  channel number 100
- * @CHAN_ENUM_104:  channel number 104
- * @CHAN_ENUM_108:  channel number 108
- * @CHAN_ENUM_112:  channel number 112
- * @CHAN_ENUM_116:  channel number 116
- * @CHAN_ENUM_120:  channel number 120
- * @CHAN_ENUM_124:  channel number 124
- * @CHAN_ENUM_128:  channel number 128
- * @CHAN_ENUM_132:  channel number 132
- * @CHAN_ENUM_136:  channel number 136
- * @CHAN_ENUM_140:  channel number 140
- * @CHAN_ENUM_144:  channel number 144
- * @CHAN_ENUM_149:  channel number 149
- * @CHAN_ENUM_153:  channel number 153
- * @CHAN_ENUM_157:  channel number 157
- * @CHAN_ENUM_161:  channel number 161
- * @CHAN_ENUM_165:  channel number 165
+ * struct regulatory_channel
+ * @center_freq: center frequency
+ * @chan_num: channel number
+ * @state: channel state
+ * @chan_flags: channel flags
+ * @tx_power: TX powers
+ * @min_bw: min bandwidth
+ * @max_bw: max bandwidth
+ * @nol_chan: whether channel is nol
  */
-enum channel_enum {
-	CHAN_ENUM_1,
-	CHAN_ENUM_2,
-	CHAN_ENUM_3,
-	CHAN_ENUM_4,
-	CHAN_ENUM_5,
-	CHAN_ENUM_6,
-	CHAN_ENUM_7,
-	CHAN_ENUM_8,
-	CHAN_ENUM_9,
-	CHAN_ENUM_10,
-	CHAN_ENUM_11,
-	CHAN_ENUM_12,
-	CHAN_ENUM_13,
-	CHAN_ENUM_14,
-
-	CHAN_ENUM_36,
-	CHAN_ENUM_40,
-	CHAN_ENUM_44,
-	CHAN_ENUM_48,
-	CHAN_ENUM_52,
-	CHAN_ENUM_56,
-	CHAN_ENUM_60,
-	CHAN_ENUM_64,
-
-	CHAN_ENUM_100,
-	CHAN_ENUM_104,
-	CHAN_ENUM_108,
-	CHAN_ENUM_112,
-	CHAN_ENUM_116,
-	CHAN_ENUM_120,
-	CHAN_ENUM_124,
-	CHAN_ENUM_128,
-	CHAN_ENUM_132,
-	CHAN_ENUM_136,
-	CHAN_ENUM_140,
-	CHAN_ENUM_144,
-
-	CHAN_ENUM_149,
-	CHAN_ENUM_153,
-	CHAN_ENUM_157,
-	CHAN_ENUM_161,
-	CHAN_ENUM_165,
-
-	NUM_CHANNELS,
-
-	MIN_24GHZ_CHANNEL = CHAN_ENUM_1,
-	MAX_24GHZ_CHANNEL = CHAN_ENUM_14,
-	NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),
-
-	MIN_5GHZ_CHANNEL = CHAN_ENUM_36,
-	MAX_5GHZ_CHANNEL = CHAN_ENUM_165,
-	NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1),
-
-	INVALID_CHANNEL = 0xBAD,
+struct regulatory_channel {
+	uint32_t center_freq;
+	uint32_t chan_num;
+	enum channel_state state;
+	uint32_t chan_flags;
+	uint32_t tx_power;
+	uint16_t min_bw;
+	uint16_t max_bw;
+	bool nol_chan;
 };
 
+
 /**
  * struct regulatory: regulatory information
  * @reg_domain: regulatory domain pair
@@ -389,6 +433,7 @@ enum ht_sec_ch_offset {
 	HIGH_PRIMARY_CH = 3,
 };
 
+
 extern const struct chan_map channel_map[NUM_CHANNELS];
 
 enum channel_enum reg_get_chan_enum(uint32_t chan_num);
@@ -485,8 +530,7 @@ QDF_STATUS reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
 				     *chan_list);
 
 void reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
-		uint8_t num_ch, bool nol_ch);
-
+		       uint8_t num_ch, bool nol_ch);
 
 /**
  * reg_is_dfs_ch () - Checks the channel state for DFS
@@ -497,10 +541,27 @@ void reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
  */
 bool reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan);
 
-bool reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan);
+bool reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev,
+				  uint32_t chan);
 
 uint32_t reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, uint32_t freq);
 
 uint32_t reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, uint32_t chan_num);
 
+/**
+ * reg_set_config_vars () - set configration variables
+ * @psoc: psoc ptr
+ * @config_vars: configuration struct
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS reg_set_config_vars(struct wlan_objmgr_psoc *psoc,
+			       struct reg_config_vars config_vars);
+
+bool reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc);
+
+void reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc,
+			       struct regulatory_channel *reg_channels,
+			       uint8_t *alpha2,
+			       enum dfs_reg dfs_region);
 #endif

+ 6 - 6
umac/regulatory/dispatcher/inc/reg_services_public_struct.h

@@ -76,30 +76,30 @@ struct cur_regulatory_info {
 
 /**
  * enum band_info
+ * @BAND_ALL:all bands
  * @BAND_2G: 2G band
  * @BAND_5G: 5G band
- * @BAND_ALL: both bands
  */
 enum band_info {
+	BAND_ALL,
 	BAND_2G,
 	BAND_5G,
-	BAND_ALL,
 };
 
 /**
- * struct reg_ini_vars
+ * struct reg_config_vars
  * @enable_11d_support: enable 11d support
  * @userspace_ctry_priority: user priority
  * @band_capability: band capability
  * @dfs_disable: dfs disabled
  * @indoor_channel_support: indoor channel support
  */
-struct reg_ini_vars {
+struct reg_config_vars {
 	uint32_t enable_11d_support;
 	uint32_t userspace_ctry_priority;
 	enum band_info band_capability;
-	uint32_t dfs_disable;
-	uint32_t indoor_channel_support;
+	uint32_t dfs_enabled;
+	uint32_t indoor_chan_enabled;
 };
 
 struct set_band_req {

+ 22 - 6
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -33,9 +33,12 @@
 #define WLAN_REG_MAX_24GHZ_CH_NUM REG_MAX_24GHZ_CH_NUM
 #define WLAN_REG_MIN_5GHZ_CH_NUM REG_MIN_5GHZ_CH_NUM
 #define WLAN_REG_MAX_5GHZ_CH_NUM REG_MAX_5GHZ_CH_NUM
+#define WLAN_REG_MIN_11P_CH_NUM REG_MIN_11P_CH_NUM
+#define WLAN_REG_MAX_11P_CH_NUM REG_MAX_11P_CH_NUM
 
-#define WLAN_REG_IS_24GHZ_CH(ch) REG_IS_24GHZ_CH(ch)
-#define WLAN_REG_IS_5GHZ_CH(ch) REG_IS_5GHZ_CH(ch)
+#define WLAN_REG_IS_24GHZ_CH(chan) REG_IS_24GHZ_CH(chan)
+#define WLAN_REG_IS_5GHZ_CH(chan) REG_IS_5GHZ_CH(chan)
+#define WLAN_REG_IS_11P_CH(chan) REG_IS_11P_CH(chan)
 
 #define WLAN_REG_CH_NUM(ch_enum) REG_CH_NUM(ch_enum)
 #define WLAN_REG_CH_TO_FREQ(ch_enum) REG_CH_TO_FREQ(ch_enum)
@@ -290,21 +293,34 @@ QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev
 					  *pdev,
 					  struct regulatory_channel
 					  *chan_list);
-void wlan_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
-		uint8_t num_ch, bool nol_ch);
+
+/**
+ * wlan_reg_update_nol_ch () - set nol channel
+ * @pdev: pdev ptr
+ * @ch_list: channel list to be returned
+ * @num_ch: number of channels
+ * @nol_ch: nol flag
+ *
+ * Return: void
+ */
+void wlan_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev,
+			    uint8_t *ch_list,
+			    uint8_t num_ch,
+			    bool nol_ch);
 
 /**
  * wlan_reg_is_dfs_ch () - Checks the channel state for DFS
+ * @pdev: pdev ptr
  * @chan: channel
  *
  * Return: true or false
  */
-bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev,
-			uint32_t chan);
+bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan);
 
 /**
  * wlan_reg_is_passive_or_disable_ch () - Checks chan state for passive
  * and disabled
+ * @pdev: pdev ptr
  * @chan: channel
  *
  * Return: true or false

+ 42 - 0
umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h

@@ -46,4 +46,46 @@ QDF_STATUS ucfg_reg_unregister_event_handler(uint8_t vdev_id, reg_event_cb cb,
 		void *arg);
 QDF_STATUS ucfg_reg_init_handler(uint8_t pdev_id);
 
+/**
+ * ucfg_reg_set_config_vars () - Set the config vars in reg component
+ * @psoc: psoc ptr
+ * @config_vars: config variables structure
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_reg_set_config_vars(struct wlan_objmgr_psoc *psoc,
+				    struct reg_config_vars config_vars);
+
+/**
+ * ucfg_reg_get_current_chan_list () - get current channel list
+ * @pdev: pdev ptr
+ * @chan_list: channel list
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
+				    struct regulatory_channel *chan_list);
+
+/**
+ * ucfg_reg_is_regdb_offloaded () - is regulatory database offloaded
+ * @psoc: psoc ptr
+ *
+ * Return: bool
+ */
+bool ucfg_reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * ucfg_reg_program_mas_chan_list () - program master channel list
+ * @psoc: psoc ptr
+ * @reg_channels: regulatory channels
+ * @alpha2: country code
+ * @dfs_region: dfs region
+ *
+ * Return: void
+ */
+void ucfg_reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc,
+				    struct regulatory_channel *reg_channels,
+				    uint8_t *alpha2,
+				    enum dfs_reg dfs_region);
+
 #endif

+ 2 - 11
umac/regulatory/dispatcher/src/wlan_reg_services_api.c

@@ -142,12 +142,6 @@ void wlan_reg_get_dfs_region(struct wlan_objmgr_psoc *psoc,
 	reg_get_dfs_region(psoc, dfs_reg);
 }
 
-/**
- * wlan_reg_get_channel_reg_power() - get regulatory power for channel
- * @chan_num: channel number
- *
- * Return: int
- */
 uint32_t wlan_reg_get_channel_reg_power(struct wlan_objmgr_pdev *pdev,
 					uint32_t chan_num)
 {
@@ -382,7 +376,8 @@ void wlan_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
 	reg_update_nol_ch(pdev, ch_list, num_ch, nol_ch);
 }
 
-bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan)
+bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev,
+			uint32_t chan)
 {
 	return reg_is_dfs_ch(pdev, chan);
 }
@@ -404,7 +399,3 @@ uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
 {
 	return reg_chan_to_freq(pdev, chan_num);
 }
-
-
-
-

+ 25 - 0
umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c

@@ -88,3 +88,28 @@ QDF_STATUS ucfg_reg_init_handler(uint8_t pdev_id)
 	/* regulatory initialization handler */
 	return QDF_STATUS_SUCCESS;
 }
+
+QDF_STATUS ucfg_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
+					  struct regulatory_channel *chan_list)
+{
+	return reg_get_current_chan_list(pdev, chan_list);
+}
+
+QDF_STATUS ucfg_reg_set_config_vars(struct wlan_objmgr_psoc *psoc,
+				 struct reg_config_vars config_vars)
+{
+	return reg_set_config_vars(psoc, config_vars);
+}
+
+bool ucfg_reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc)
+{
+	return reg_is_regdb_offloaded(psoc);
+}
+
+void ucfg_reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc,
+				    struct regulatory_channel *reg_channels,
+				    uint8_t *alpha2,
+				    enum dfs_reg dfs_region)
+{
+	reg_program_mas_chan_list(psoc, reg_channels, alpha2, dfs_region);
+}