qcacld-3.0: Wiphy initialization for regulatory offload

For regulatory offload, send the regulatory config settings to regulatory
component to compute the current channel list. Query channel list for
each band. Populate the channel list in wiphy. Also do not register
regulatory notifier with the kernel anymore.

CRs-Fixed: 2008013
Change-Id: Ia4995c7498d97fe1e37717e65daa9dcacb2f21b3
diff --git a/core/cds/inc/cds_api.h b/core/cds/inc/cds_api.h
index 7ee074f..dafc383 100644
--- a/core/cds/inc/cds_api.h
+++ b/core/cds/inc/cds_api.h
@@ -42,6 +42,7 @@
 #include <qdf_trace.h>
 #include <qdf_event.h>
 #include <qdf_lock.h>
+#include "reg_services_public_struct.h"
 #include <cds_reg_service.h>
 #include <cds_packet.h>
 #include <cds_sched.h>
diff --git a/core/cds/inc/cds_reg_service.h b/core/cds/inc/cds_reg_service.h
index a596e3e..50f3138 100644
--- a/core/cds/inc/cds_reg_service.h
+++ b/core/cds/inc/cds_reg_service.h
@@ -37,30 +37,31 @@
    ========================================================================*/
 
 #include "qdf_status.h"
+#include <reg_services_public_struct.h>
+#include <wlan_reg_services_api.h>
 
 #define CDS_COUNTRY_CODE_LEN  2
 #define CDS_MAC_ADDRESS_LEN 6
 #define CDS_SBS_SEPARATION_THRESHOLD 100
+#define HT40PLUS_2G_FCC_CH_END       7
+#define HT40PLUS_2G_EURJAP_CH_END    9
+#define HT40MINUS_2G_CH_START        5
+#define HT40MINUS_2G_CH_END          13
+
 
 #define CDS_CHANNEL_STATE(chan_enum) reg_channels[chan_enum].state
-#define CDS_CHANNEL_NUM(chan_enum) chan_mapping[chan_enum].chan_num
-#define CDS_CHANNEL_FREQ(chan_enum) chan_mapping[chan_enum].center_freq
+#define CDS_CHANNEL_NUM(chan_enum) channel_map[chan_enum].chan_num
+#define CDS_CHANNEL_FREQ(chan_enum) channel_map[chan_enum].center_freq
 #define CDS_IS_DFS_CH(chan_num) (cds_get_channel_state((chan_num)) == \
 				CHANNEL_STATE_DFS)
 
 #define CDS_IS_PASSIVE_OR_DISABLE_CH(chan_num) \
 	(cds_get_channel_state(chan_num) != CHANNEL_STATE_ENABLE)
 
-#define CDS_MIN_24GHZ_CHANNEL_NUMBER chan_mapping[MIN_24GHZ_CHANNEL].chan_num
-#define CDS_MAX_24GHZ_CHANNEL_NUMBER chan_mapping[MAX_24GHZ_CHANNEL].chan_num
-#define CDS_MIN_59GHZ_CHANNEL_NUMBER chan_mapping[MIN_59GHZ_CHANNEL].chan_num
-#define CDS_MAX_59GHZ_CHANNEL_NUMBER chan_mapping[MAX_59GHZ_CHANNEL].chan_num
-#define CDS_MIN_5GHZ_CHANNEL_NUMBER chan_mapping[MIN_5GHZ_CHANNEL].chan_num
-#define CDS_MAX_5GHZ_CHANNEL_NUMBER chan_mapping[MAX_5GHZ_CHANNEL].chan_num
-
-#define CDS_IS_CHANNEL_DSRC(chan_num) \
-	((chan_num >= CDS_MIN_59GHZ_CHANNEL_NUMBER) && \
-	 (chan_num <= CDS_MAX_59GHZ_CHANNEL_NUMBER))
+#define CDS_MIN_24GHZ_CHANNEL_NUMBER channel_map[MIN_24GHZ_CHANNEL].chan_num
+#define CDS_MAX_24GHZ_CHANNEL_NUMBER channel_map[MAX_24GHZ_CHANNEL].chan_num
+#define CDS_MIN_5GHZ_CHANNEL_NUMBER channel_map[MIN_5GHZ_CHANNEL].chan_num
+#define CDS_MAX_5GHZ_CHANNEL_NUMBER channel_map[MAX_5GHZ_CHANNEL].chan_num
 
 #define CDS_IS_CHANNEL_5GHZ(chan_num) \
 	((chan_num >= CDS_MIN_5GHZ_CHANNEL_NUMBER) && \
@@ -74,9 +75,6 @@
 	(chan_num1 && chan_num2 && \
 	(CDS_IS_CHANNEL_5GHZ(chan_num1) == CDS_IS_CHANNEL_5GHZ(chan_num2)))
 
-#define CDS_MIN_11P_CHANNEL chan_mapping[MIN_59GHZ_CHANNEL].chan_num
-
-/* assumption is the 2 channels passed are 5G channels */
 #define CDS_IS_CHANNEL_VALID_5G_SBS(curchan, newchan) \
 	(curchan > newchan ? \
 	CDS_CHANNEL_FREQ(cds_get_channel_enum(curchan)) \
@@ -86,301 +84,8 @@
 	- CDS_CHANNEL_FREQ(cds_get_channel_enum(curchan)) \
 	 > CDS_SBS_SEPARATION_THRESHOLD)
 
-typedef enum {
-	REGDOMAIN_FCC,
-	REGDOMAIN_ETSI,
-	REGDOMAIN_JAPAN,
-	REGDOMAIN_WORLD,
-	REGDOMAIN_COUNT
-} v_REGDOMAIN_t;
+extern const struct chan_map channel_map[NUM_CHANNELS];
 
-
-/**
- * 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_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 108
- * @CHAN_ENUM_171: channel number 112
- * @CHAN_ENUM_172: channel number 116
- * @CHAN_ENUM_173: channel number 120
- * @CHAN_ENUM_174: channel number 124
- * @CHAN_ENUM_175: channel number 128
- * @CHAN_ENUM_176: channel number 132
- * @CHAN_ENUM_177: channel number 136
- * @CHAN_ENUM_178: channel number 140
- * @CHAN_ENUM_179: channel number 144
- * @CHAN_ENUM_180: channel number 149
- * @CHAN_ENUM_181: channel number 153
- * @CHAN_ENUM_182: channel number 157
- * @CHAN_ENUM_183: channel number 161
- * @CHAN_ENUM_184: channel number 165
- */
-enum channel_enum {
-	CHAN_ENUM_1 = 0,
-	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_59GHZ_CHANNEL = CHAN_ENUM_170,
-	MAX_59GHZ_CHANNEL = CHAN_ENUM_184,
-
-	INVALID_CHANNEL = 0xBAD,
-};
-
-/**
- * enum channel_state: channel state
- * @CHANNEL_STATE_DISABLE: channel disabled
- * @CHANNEL_STATE_DFS: rx enabled, tx DFS
- * @CHANNEL_STATE_ENABLE: tx/rx enabled
- * @CHANNEL_STATE_INVALID: not a valid channel
- */
-enum channel_state {
-	CHANNEL_STATE_DISABLE,
-	CHANNEL_STATE_DFS,
-	CHANNEL_STATE_ENABLE,
-	CHANNEL_STATE_INVALID,
-};
-
-/**
- * struct regulatory_channel: regulatory channel
- * @state: channel state
- * @flags: channel flags
- * @pwr_limit: channel tx power limit
- */
-struct regulatory_channel {
-	uint32_t state:4;
-	uint32_t flags:28;
-	int8_t pwr_limit;
-};
-
-/**
- * struct chan_map: channel mapping
- * @center_freq: channel center freq
- * @chan_num: channel number
- */
-struct chan_map {
-	uint16_t center_freq;
-	uint16_t chan_num;
-};
-
-/**
- * struct channel_power: channel power
- * @chan_num: channel number
- * @power: tx power
- */
-struct channel_power {
-	uint8_t chan_num;
-	int8_t power;
-};
-
-/**
- * enum country_src: country source
- * @SOURCE_QUERY: source query
- * @SOURCE_CORE: source regulatory core
- * @SOURCE_DRIVER: source driver
- * @SOURCE_USERSPACE: source userspace
- * @SOURCE_11D: source 11D
- */
-enum country_src {
-	SOURCE_UNKNOWN,
-	SOURCE_QUERY,
-	SOURCE_CORE,
-	SOURCE_DRIVER,
-	SOURCE_USERSPACE,
-	SOURCE_11D
-};
-
-/**
- * struct regulatory: regulatory information
- * @reg_domain: regulatory domain pair
- * @eeprom_rd_ext: eeprom value
- * @country_code: current country in integer
- * @alpha2: current alpha2
- * @def_country: default country alpha2
- * @def_region: DFS region
- * @ctl_2g: 2G CTL value
- * @ctl_5g: 5G CTL value
- * @reg_pair: pointer to regulatory pair
- * @cc_src: country code src
- * @reg_flags: kernel regulatory flags
- */
-struct regulatory {
-	uint32_t reg_domain;
-	uint32_t eeprom_rd_ext;
-	uint16_t country_code;
-	uint8_t alpha2[CDS_COUNTRY_CODE_LEN + 1];
-	uint8_t ctl_2g;
-	uint8_t ctl_5g;
-	const void *regpair;
-	enum country_src cc_src;
-	uint32_t reg_flags;
-};
-
-/**
- * enum phy_ch_width - physical layer channel width
- * @CH_WIDTH_20MHZ: channel width 20 mhz
- * @CH_WIDTH_40MHZ: channel width 40 mhz
- * @CH_WIDTH_80MHZ: channel width 80 mhz
- * @CH_WIDTH_160MHZ: channel width 160 mhz
- * @CH_WIDTH_80P80MHZ: channel width 80+80 mhz
- * @CH_WIDTH_5MHZ: channel width 5 mhz
- * @CH_WIDTH_10MHZ: channel width 10 mhz
- * @CH_WIDTH_INVALID: invalid channel width
- * @CH_WIDTH_MAX: maximum channel width
- */
-enum phy_ch_width {
-	CH_WIDTH_20MHZ = 0,
-	CH_WIDTH_40MHZ,
-	CH_WIDTH_80MHZ,
-	CH_WIDTH_160MHZ,
-	CH_WIDTH_80P80MHZ,
-	CH_WIDTH_5MHZ,
-	CH_WIDTH_10MHZ,
-	CH_WIDTH_INVALID,
-	CH_WIDTH_MAX
-};
-
-#define HT40PLUS_2G_FCC_CH_END       7
-#define HT40PLUS_2G_EURJAP_CH_END    9
-#define HT40MINUS_2G_CH_START        5
-#define HT40MINUS_2G_CH_END          13
-
-/**
- * struct ch_params_s
- * @ch_width: channel width
- * @sec_ch_offset: secondary channel offset
- * @center_freq_seg0: center freq for segment 0
- * @center_freq_seg1: center freq for segment 1
- */
-struct ch_params_s {
-	enum phy_ch_width ch_width;
-	uint8_t sec_ch_offset;
-	uint8_t center_freq_seg0;
-	uint8_t center_freq_seg1;
-};
-
-/**
- * enum dfs_region - DFS region
- * @DFS_UNINIT_REGION: un-initialized region
- * @DFS_FCC_REGION: FCC region
- * @DFS_ETSI_REGION: ETSI region
- * @DFS_MKK_REGION: MKK region
- * @DFS_CN_REGION: China region
- * @DFS_KR_REGION: Korea region
- * @DFS_UNDEF_REGION: Undefined region
- */
-enum dfs_region {
-	DFS_UNINIT_REGION = 0,
-	DFS_FCC_REGION = 1,
-	DFS_ETSI_REGION = 2,
-	DFS_MKK_REGION = 3,
-	DFS_CN_REGION = 4,
-	DFS_KR_REGION = 5,
-	DFS_UNDEF_REGION
-};
-
-extern const struct chan_map chan_mapping[NUM_CHANNELS];
 extern struct regulatory_channel reg_channels[NUM_CHANNELS];
 
 QDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *pRegDomain,
@@ -438,8 +143,6 @@
  * Return: frequency
  */
 uint32_t cds_get_channel_freq(uint32_t chan_num);
-QDF_STATUS cds_get_dfs_region(enum dfs_region *dfs_reg);
-QDF_STATUS cds_put_dfs_region(enum dfs_region dfs_reg);
 
 bool cds_is_dsrc_channel(uint16_t center_freq);
 enum channel_state cds_get_5g_bonded_channel_state(uint16_t chan_num,
@@ -460,7 +163,7 @@
 						enum phy_ch_width ch_width,
 						uint16_t sec_ch);
 void cds_set_channel_params(uint16_t oper_ch, uint16_t ht_offset_2g,
-			    struct ch_params_s *ch_params);
+			    struct ch_params *ch_params);
 
 QDF_STATUS cds_set_reg_domain(void *client_ctxt, v_REGDOMAIN_t reg_domain);
 QDF_STATUS cds_put_default_country(uint8_t *def_country);
diff --git a/core/cds/inc/cds_regdomain.h b/core/cds/inc/cds_regdomain.h
index 5c3d831..532ba8a 100644
--- a/core/cds/inc/cds_regdomain.h
+++ b/core/cds/inc/cds_regdomain.h
@@ -466,7 +466,7 @@
 };
 
 /**
- * enum ctl_val - CTL value
+ * enum ctl_val: CTL value
  * @FCC: FCC
  * @MKK: MKK
  * @ETSI: ETSI
@@ -480,22 +480,6 @@
 };
 
 /**
- * enum offset_t: channel offset
- * @BW20: 20 mhz channel
- * @BW40_LOW_PRIMARY: lower channel in 40 mhz
- * @BW40_HIGH_PRIMARY: higher channel in 40 mhz
- * @BW80: 80 mhz channel
- * @BWALL: unknown bandwidth
- */
-enum offset_t {
-	BW20 = 0,
-	BW40_LOW_PRIMARY = 1,
-	BW40_HIGH_PRIMARY = 3,
-	BW80,
-	BWALL
-};
-
-/**
  * struct reg_dmn_pair: regulatory domain pair
  * @reg_dmn_pair: reg domain pair
  * @reg_dmn_5ghz: 5G reg domain
@@ -534,30 +518,6 @@
 };
 
 /**
- * struct reg_dmn_op_class_map_t: operating class
- * @op_class: operating class number
- * @ch_spacing: channel spacing
- * @offset: offset
- * @channels: channel set
- */
-struct reg_dmn_op_class_map_t {
-	uint8_t op_class;
-	uint8_t ch_spacing;
-	enum offset_t offset;
-	uint8_t channels[MAX_CHANNELS_PER_OPERATING_CLASS];
-};
-
-/**
- * struct reg_dmn_supp_op_classes: operating classes
- * @num_classes: number of classes
- * @classes: classes
- */
-struct reg_dmn_supp_op_classes {
-	uint8_t num_classes;
-	uint8_t classes[CDS_MAX_SUPP_OPER_CLASSES];
-};
-
-/**
  * struct reg_dmn_tables: reg domain table
  * @reg_dmn_pairs: list of reg domain pairs
  * @all_countries: list of countries
diff --git a/core/cds/src/cds_reg_service.c b/core/cds/src/cds_reg_service.c
index e162bb1..fa3b072 100644
--- a/core/cds/src/cds_reg_service.c
+++ b/core/cds/src/cds_reg_service.c
@@ -41,67 +41,6 @@
 #include "sme_api.h"
 #include "wlan_hdd_main.h"
 
-const struct chan_map chan_mapping[NUM_CHANNELS] = {
-	[CHAN_ENUM_1] = {2412, 1},
-	[CHAN_ENUM_2] = {2417, 2},
-	[CHAN_ENUM_3] = {2422, 3},
-	[CHAN_ENUM_4] = {2427, 4},
-	[CHAN_ENUM_5] = {2432, 5},
-	[CHAN_ENUM_6] = {2437, 6},
-	[CHAN_ENUM_7] = {2442, 7},
-	[CHAN_ENUM_8] = {2447, 8},
-	[CHAN_ENUM_9] = {2452, 9},
-	[CHAN_ENUM_10] = {2457, 10},
-	[CHAN_ENUM_11] = {2462, 11},
-	[CHAN_ENUM_12] = {2467, 12},
-	[CHAN_ENUM_13] = {2472, 13},
-	[CHAN_ENUM_14] = {2484, 14},
-
-	[CHAN_ENUM_36] = {5180, 36},
-	[CHAN_ENUM_40] = {5200, 40},
-	[CHAN_ENUM_44] = {5220, 44},
-	[CHAN_ENUM_48] = {5240, 48},
-	[CHAN_ENUM_52] = {5260, 52},
-	[CHAN_ENUM_56] = {5280, 56},
-	[CHAN_ENUM_60] = {5300, 60},
-	[CHAN_ENUM_64] = {5320, 64},
-
-	[CHAN_ENUM_100] = {5500, 100},
-	[CHAN_ENUM_104] = {5520, 104},
-	[CHAN_ENUM_108] = {5540, 108},
-	[CHAN_ENUM_112] = {5560, 112},
-	[CHAN_ENUM_116] = {5580, 116},
-	[CHAN_ENUM_120] = {5600, 120},
-	[CHAN_ENUM_124] = {5620, 124},
-	[CHAN_ENUM_128] = {5640, 128},
-	[CHAN_ENUM_132] = {5660, 132},
-	[CHAN_ENUM_136] = {5680, 136},
-	[CHAN_ENUM_140] = {5700, 140},
-	[CHAN_ENUM_144] = {5720, 144},
-
-	[CHAN_ENUM_149] = {5745, 149},
-	[CHAN_ENUM_153] = {5765, 153},
-	[CHAN_ENUM_157] = {5785, 157},
-	[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},
-};
-
 /**
  * struct bonded_chan
  * @start_ch: start channel
@@ -153,7 +92,6 @@
 
 struct regulatory_channel reg_channels[NUM_CHANNELS];
 static uint8_t default_country[CDS_COUNTRY_CODE_LEN + 1];
-static enum dfs_region dfs_region;
 
 /**
  * cds_get_channel_list_with_power() - retrieve channel list with power
@@ -174,9 +112,9 @@
 		for (i = 0; i < NUM_CHANNELS; i++) {
 			if (reg_channels[i].state) {
 				base_channels[count].chan_num =
-					chan_mapping[i].chan_num;
-				base_channels[count++].power =
-					reg_channels[i].pwr_limit;
+					channel_map[i].chan_num;
+				base_channels[count++].tx_power =
+					reg_channels[i].tx_power;
 			}
 		}
 		*num_base_channels = count;
@@ -215,8 +153,8 @@
 {
 	uint32_t loop;
 
-	for (loop = 0; loop <= CHAN_ENUM_184; loop++)
-		if (chan_mapping[loop].chan_num == chan_num)
+	for (loop = 0; loop < NUM_CHANNELS; loop++)
+		if (channel_map[loop].chan_num == chan_num)
 			return loop;
 
 	QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
@@ -251,7 +189,7 @@
 	if (chan_enum == INVALID_CHANNEL)
 		return CHANNEL_STATE_INVALID;
 	else
-		return reg_channels[chan_enum].pwr_limit;
+		return reg_channels[chan_enum].tx_power;
 }
 
 uint32_t cds_get_channel_flags(uint32_t chan_num)
@@ -262,7 +200,7 @@
 	if (chan_enum == INVALID_CHANNEL)
 		return CHANNEL_STATE_INVALID;
 	else
-		return reg_channels[chan_enum].flags;
+		return reg_channels[chan_enum].chan_flags;
 }
 
 uint32_t cds_get_vendor_reg_flags(uint32_t chan, uint16_t bandwidth,
@@ -271,7 +209,7 @@
 {
 	uint32_t flags = 0;
 	enum channel_state state;
-	struct ch_params_s ch_params;
+	struct ch_params ch_params;
 
 	state = cds_get_channel_state(chan);
 	if (state == CHANNEL_STATE_INVALID)
@@ -376,7 +314,7 @@
 	if (chan_enum == INVALID_CHANNEL)
 		return CHANNEL_STATE_INVALID;
 	else
-		return chan_mapping[chan_enum].center_freq;
+		return channel_map[chan_enum].center_freq;
 }
 
 /**
@@ -514,13 +452,13 @@
 	if (CH_WIDTH_5MHZ == ch_width)
 		bw_enabled = true;
 	else if (CH_WIDTH_10MHZ == ch_width)
-		bw_enabled = !(reg_channels[chan_enum].flags &
+		bw_enabled = !(reg_channels[chan_enum].chan_flags &
 			       IEEE80211_CHAN_NO_10MHZ);
 	else if (CH_WIDTH_20MHZ == ch_width)
-		bw_enabled = !(reg_channels[chan_enum].flags &
+		bw_enabled = !(reg_channels[chan_enum].chan_flags &
 			       IEEE80211_CHAN_NO_20MHZ);
 	else if (CH_WIDTH_40MHZ == ch_width)
-		bw_enabled = !((reg_channels[chan_enum].flags &
+		bw_enabled = !((reg_channels[chan_enum].chan_flags &
 				IEEE80211_CHAN_NO_HT40) == IEEE80211_CHAN_NO_HT40);
 
 	if (bw_enabled)
@@ -559,22 +497,22 @@
 	if (CH_WIDTH_5MHZ == ch_width)
 		bw_enabled = true;
 	else if (CH_WIDTH_10MHZ == ch_width)
-		bw_enabled = !(reg_channels[chan_enum].flags &
+		bw_enabled = !(reg_channels[chan_enum].chan_flags &
 			       IEEE80211_CHAN_NO_10MHZ);
 	else if (CH_WIDTH_20MHZ == ch_width)
-		bw_enabled = !(reg_channels[chan_enum].flags &
+		bw_enabled = !(reg_channels[chan_enum].chan_flags &
 			       IEEE80211_CHAN_NO_20MHZ);
 	else if (CH_WIDTH_40MHZ == ch_width)
-		bw_enabled = !((reg_channels[chan_enum].flags &
+		bw_enabled = !((reg_channels[chan_enum].chan_flags &
 				IEEE80211_CHAN_NO_HT40) == IEEE80211_CHAN_NO_HT40);
 	else if (CH_WIDTH_80MHZ == ch_width)
-		bw_enabled = !(reg_channels[chan_enum].flags &
+		bw_enabled = !(reg_channels[chan_enum].chan_flags &
 			       IEEE80211_CHAN_NO_80MHZ);
 	else if (CH_WIDTH_160MHZ == ch_width)
-		bw_enabled = !(reg_channels[chan_enum].flags &
+		bw_enabled = !(reg_channels[chan_enum].chan_flags &
 			       IEEE80211_CHAN_NO_160MHZ);
 	else if (CH_WIDTH_80P80MHZ == ch_width)
-		bw_enabled = !(reg_channels[chan_enum].flags &
+		bw_enabled = !(reg_channels[chan_enum].chan_flags &
 			       IEEE80211_CHAN_NO_80MHZ);
 
 	if (bw_enabled)
@@ -609,7 +547,7 @@
  * Return: void
  */
 static void cds_set_5g_channel_params(uint16_t oper_ch,
-				      struct ch_params_s *ch_params)
+				      struct ch_params *ch_params)
 {
 	enum channel_state chan_state = CHANNEL_STATE_ENABLE;
 	enum channel_state chan_state2 = CHANNEL_STATE_ENABLE;
@@ -697,7 +635,7 @@
  * Return: void
  */
 static void cds_set_2g_channel_params(uint16_t oper_ch,
-			       struct ch_params_s *ch_params,
+			       struct ch_params *ch_params,
 			       uint16_t sec_ch_2g)
 {
 	enum channel_state chan_state = CHANNEL_STATE_ENABLE;
@@ -745,7 +683,7 @@
  * Return: void
  */
 void cds_set_channel_params(uint16_t oper_ch, uint16_t sec_ch_2g,
-			    struct ch_params_s *ch_params)
+			    struct ch_params *ch_params)
 {
 	if (CDS_IS_CHANNEL_5GHZ(oper_ch))
 		cds_set_5g_channel_params(oper_ch, ch_params);
@@ -754,19 +692,6 @@
 }
 
 /**
- * cds_get_dfs_region() - get the dfs_region
- * @dfs_region: the dfs_region to return
- *
- * Return: QDF_STATUS
- */
-QDF_STATUS cds_get_dfs_region(enum dfs_region *dfs_reg)
-{
-	*dfs_reg = dfs_region;
-
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
  * cds_get_reg_domain_from_country_code() - get the regulatory domain
  * @reg_domain_ptr: ptr to store regulatory domain
  *
@@ -864,19 +789,6 @@
 }
 
 /**
- * cds_put_dfs_region() - save dfs region
- * @dfs_reg: dfs region
- *
- * Return: QDF_STATUS
- */
-QDF_STATUS cds_put_dfs_region(enum dfs_region dfs_reg)
-{
-	dfs_region = dfs_reg;
-
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
  * cds_put_default_country() - save the default country
  * @dfs_country: default country
  *
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h
index 09b4fb1..224d99f 100644
--- a/core/hdd/inc/wlan_hdd_cfg.h
+++ b/core/hdd/inc/wlan_hdd_cfg.h
@@ -9786,6 +9786,26 @@
 #define CFG_QCN_IE_SUPPORT_MAX      1
 #define CFG_QCN_IE_SUPPORT_DEFAULT  0
 
+/* enable_reg_offload - enable regulatory offload
+ * @Min: 0
+ * @Max: 1
+ * @Default: 1
+ *
+ * This ini is used to enable or disable reg offload
+ *
+ * Related: None
+ *
+ * Supported Feature: reg offload
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_ENABLE_REG_OFFLOAD_NAME      "enable_reg_offload"
+#define CFG_ENABLE_REG_OFFLOAD_MIN       (0)
+#define CFG_ENABLE_REG_OFFLOAD_MAX       (1)
+#define CFG_ENABLE_REG_OFFLOAD_DEFAULT   (0)
+
 /*
  * Type declarations
  */
@@ -10504,6 +10524,7 @@
 	uint32_t arp_ac_category;
 	bool ani_enabled;
 	bool qcn_ie_support;
+	bool reg_offload_enabled;
 };
 
 #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var))
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h
index 308c44c..d1c0026 100644
--- a/core/hdd/inc/wlan_hdd_main.h
+++ b/core/hdd/inc/wlan_hdd_main.h
@@ -856,7 +856,7 @@
  */
 struct hdd_chan_change_params {
 	uint8_t chan;
-	struct ch_params_s chan_params;
+	struct ch_params chan_params;
 };
 
 /**
@@ -1609,6 +1609,7 @@
 	enum scan_reject_states last_scan_reject_reason;
 	unsigned long last_scan_reject_timestamp;
 	bool dfs_cac_offload;
+	bool reg_offload;
 };
 
 /**
diff --git a/core/hdd/inc/wlan_hdd_regulatory.h b/core/hdd/inc/wlan_hdd_regulatory.h
index 6820933..24d8a06 100644
--- a/core/hdd/inc/wlan_hdd_regulatory.h
+++ b/core/hdd/inc/wlan_hdd_regulatory.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,8 +39,8 @@
 #define IEEE80211_CHAN_NO_IBSS IEEE80211_CHAN_NO_IR
 #endif
 
-void hdd_reset_global_reg_params(void);
 int hdd_regulatory_init(hdd_context_t *hdd_ctx, struct wiphy *wiphy);
 void hdd_program_country_code(hdd_context_t *hdd_ctx);
+void hdd_reset_global_reg_params(void);
 
 #endif
diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c
index f750132..eabb54b 100644
--- a/core/hdd/src/wlan_hdd_cfg.c
+++ b/core/hdd/src/wlan_hdd_cfg.c
@@ -4269,14 +4269,23 @@
 		     CFG_ENABLE_ANI_DEFAULT,
 		     CFG_ENABLE_ANI_MIN,
 		     CFG_ENABLE_ANI_MAX),
+
 	REG_VARIABLE(CFG_QCN_IE_SUPPORT_NAME, WLAN_PARAM_Integer,
 		struct hdd_config, qcn_ie_support,
 		VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
 		CFG_QCN_IE_SUPPORT_DEFAULT,
 		CFG_QCN_IE_SUPPORT_MIN,
 		CFG_QCN_IE_SUPPORT_MAX),
+
+	REG_VARIABLE(CFG_ENABLE_REG_OFFLOAD_NAME, WLAN_PARAM_Integer,
+		     struct hdd_config, reg_offload_enabled,
+		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		     CFG_ENABLE_REG_OFFLOAD_DEFAULT,
+		     CFG_ENABLE_REG_OFFLOAD_MIN,
+		     CFG_ENABLE_REG_OFFLOAD_MAX),
 };
 
+
 /**
  * get_next_line() - find and locate the new line pointer
  * @str: pointer to string
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index 6f1cea5..e85f64c 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -132,7 +132,7 @@
 		.hw_value = (chan), \
 		.flags = (flag), \
 		.max_antenna_gain = 0, \
-		.max_power = 30, \
+		.max_power = 0, \
 }
 
 #define HDD5GHZCHAN(freq, chan, flag)   {     \
@@ -141,7 +141,7 @@
 		.hw_value = (chan), \
 		.flags = (flag), \
 		.max_antenna_gain = 0, \
-		.max_power = 30, \
+		.max_power = 0, \
 }
 
 #define HDD_G_MODE_RATETAB(rate, rate_id, flag)	\
@@ -1470,7 +1470,7 @@
 {
 	int i;
 	struct hdd_channel_info *icv;
-	struct ch_params_s ch_params = {0};
+	struct ch_params ch_params = {0};
 	uint8_t bw_offset = 0, chan = 0;
 	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	tsap_Config_t *sap_config = &adapter->sessionCtx.ap.sapConfig;
@@ -10213,14 +10213,6 @@
 
 	wiphy->mgmt_stypes = wlan_hdd_txrx_stypes;
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
-	wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS;
-	wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE;
-#else
-	wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS;
-	wiphy->country_ie_pref |= NL80211_COUNTRY_IE_IGNORE_CORE;
-#endif
-
 	wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME
 			| WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD
 			| WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL
@@ -10269,8 +10261,6 @@
 	 * regulatory settings
 	 */
 
-	wiphy->reg_notifier = hdd_reg_notifier;
-
 #if  defined QCA_WIFI_FTM
 }
 #endif
@@ -10455,6 +10445,7 @@
 			wiphy->bands[i]->channels = NULL;
 		}
 	}
+
 	hdd_reset_global_reg_params();
 }
 
@@ -12755,7 +12746,7 @@
  * Return: none
  */
 void hdd_select_cbmode(hdd_adapter_t *pAdapter, uint8_t operationChannel,
-			struct ch_params_s *ch_params)
+			struct ch_params *ch_params)
 {
 	hdd_station_ctx_t *station_ctx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
 	struct hdd_mon_set_ch_info *ch_info = &station_ctx->ch_info;
@@ -16600,7 +16591,7 @@
 	tHalHandle hal_hdl;
 	struct qdf_mac_addr bssid;
 	tCsrRoamProfile roam_profile;
-	struct ch_params_s ch_params;
+	struct ch_params ch_params;
 	uint8_t sec_ch = 0;
 	int ret;
 	uint16_t chan_num = cds_freq_to_chan(chandef->chan->center_freq);
diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h
index 79ac66d..e55c0bf 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.h
+++ b/core/hdd/src/wlan_hdd_cfg80211.h
@@ -259,7 +259,7 @@
 
 void *wlan_hdd_change_country_code_cb(void *pAdapter);
 void hdd_select_cbmode(hdd_adapter_t *pAdapter, uint8_t operationChannel,
-		       struct ch_params_s *ch_params);
+		       struct ch_params *ch_params);
 
 uint8_t *wlan_hdd_cfg80211_get_ie_ptr(const uint8_t *ies_ptr, int length,
 				      uint8_t eid);
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 55a90a9..2b44004 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -123,6 +123,7 @@
 #ifdef CNSS_GENL
 #include <net/cnss_nl.h>
 #endif
+#include "wlan_reg_ucfg_api.h"
 
 #ifdef MODULE
 #define WLAN_MODULE_NAME  module_name(THIS_MODULE)
@@ -5771,8 +5772,15 @@
 /* Initialize channel list in sme based on the country code */
 QDF_STATUS hdd_set_sme_chan_list(hdd_context_t *hdd_ctx)
 {
-	return sme_init_chan_list(hdd_ctx->hHal, hdd_ctx->reg.alpha2,
-				  hdd_ctx->reg.cc_src);
+
+	if (hdd_ctx->reg_offload)
+		return sme_init_chan_list(hdd_ctx->hHal,
+					  hdd_ctx->reg.alpha2,
+					  0);
+	else
+		return sme_init_chan_list(hdd_ctx->hHal,
+					  hdd_ctx->reg.alpha2,
+					  hdd_ctx->reg.cc_src);
 }
 
 /**
@@ -5836,7 +5844,8 @@
 		return ret_val;
 	}
 
-	hdd_program_country_code(hdd_ctx);
+	if (!hdd_ctx->reg_offload)
+		hdd_program_country_code(hdd_ctx);
 
 	return ret_val;
 }
diff --git a/core/hdd/src/wlan_hdd_oemdata.c b/core/hdd/src/wlan_hdd_oemdata.c
index e037d36..29ac1d9 100644
--- a/core/hdd/src/wlan_hdd_oemdata.c
+++ b/core/hdd/src/wlan_hdd_oemdata.c
@@ -404,7 +404,7 @@
 static void hdd_update_channel_bw_info(hdd_context_t *hdd_ctx,
 	uint16_t chan, tHddChannelInfo *hdd_chan_info)
 {
-	struct ch_params_s ch_params = {0};
+	struct ch_params ch_params = {0};
 	uint16_t sec_ch_2g = 0;
 	WLAN_PHY_MODE phy_mode;
 	uint32_t wni_dot11_mode;
diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c
index bcf67fa..75066e8 100644
--- a/core/hdd/src/wlan_hdd_regulatory.c
+++ b/core/hdd/src/wlan_hdd_regulatory.c
@@ -33,16 +33,11 @@
 
 #include "qdf_types.h"
 #include "qdf_trace.h"
-#include "cds_reg_service.h"
-#include "cds_regdomain.h"
-#include "sme_api.h"
 #include "wlan_hdd_main.h"
 #include "wlan_hdd_regulatory.h"
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(WITH_BACKPORTS)
-#define IEEE80211_CHAN_PASSIVE_SCAN IEEE80211_CHAN_NO_IR
-#define IEEE80211_CHAN_NO_IBSS IEEE80211_CHAN_NO_IR
-#endif
+#include <wlan_reg_ucfg_api.h>
+#include <wlan_reg_services_api.h>
+#include "cds_reg_service.h"
 
 #define REG_RULE_2412_2462    REG_RULE(2412-10, 2462+10, 40, 0, 20, 0)
 
@@ -178,7 +173,6 @@
 		 WORLD_ROAMING_PREFIX);
 }
 
-
 /**
  * hdd_update_regulatory_info() - update regulatory info
  * @hdd_ctx: hdd context
@@ -212,6 +206,19 @@
 	init_by_reg_core = false;
 }
 
+static void reg_program_config_vars(hdd_context_t *hdd_ctx,
+				    struct reg_config_vars *config_vars)
+{
+	config_vars->enable_11d_support = hdd_ctx->config->Is11dSupportEnabled;
+	config_vars->userspace_ctry_priority =
+		hdd_ctx->config->fSupplicantCountryCodeHasPriority;
+	config_vars->dfs_enabled = hdd_ctx->config->enableDFSChnlScan;
+	config_vars->indoor_chan_enabled =
+		hdd_ctx->config->indoor_channel_support;
+	config_vars->band_capability = hdd_ctx->config->nBandCapability;
+}
+
+
 /**
  * hdd_regulatory_wiphy_init() - regulatory wiphy init
  * @hdd_ctx: hdd context
@@ -318,7 +325,6 @@
 }
 #endif
 
-
 /**
  * hdd_modify_wiphy() - modify wiphy
  * @wiphy: wiphy
@@ -394,6 +400,7 @@
 			wiphy_chan =
 				&(wiphy->bands[band_num]->channels[chan_num]);
 			cds_chan = &(reg_channels[chan_enum]);
+			cds_chan->chan_flags = 0;
 			if (CHAN_ENUM_144 == chan_enum)
 				wiphy_chan_144 = wiphy_chan;
 
@@ -404,12 +411,11 @@
 
 			if (wiphy_chan->flags & IEEE80211_CHAN_DISABLED) {
 				cds_chan->state = CHANNEL_STATE_DISABLE;
+				cds_chan->chan_flags |=
+					REGULATORY_CHAN_DISABLED;
 			} else if ((wiphy_chan->flags &
 				    (IEEE80211_CHAN_RADAR |
-				     IEEE80211_CHAN_PASSIVE_SCAN)) ||
-				   ((hdd_ctx->config->indoor_channel_support
-				     == false) &&
-				    (wiphy_chan->flags &
+				     IEEE80211_CHAN_PASSIVE_SCAN |
 				     IEEE80211_CHAN_INDOOR_ONLY))) {
 				if ((wiphy_chan->flags &
 				     IEEE80211_CHAN_INDOOR_ONLY) &&
@@ -418,12 +424,33 @@
 					wiphy_chan->flags |=
 						IEEE80211_CHAN_PASSIVE_SCAN;
 				cds_chan->state = CHANNEL_STATE_DFS;
+				if (wiphy_chan->flags & IEEE80211_CHAN_RADAR)
+					cds_chan->chan_flags |=
+						REGULATORY_CHAN_RADAR;
+				if (wiphy_chan->flags &
+				    IEEE80211_CHAN_PASSIVE_SCAN)
+					cds_chan->chan_flags |=
+						REGULATORY_CHAN_NO_IR;
+				if (wiphy_chan->flags &
+				    IEEE80211_CHAN_INDOOR_ONLY)
+					cds_chan->chan_flags |=
+						REGULATORY_CHAN_INDOOR_ONLY;
 			} else {
 				cds_chan->state = CHANNEL_STATE_ENABLE;
 			}
-			cds_chan->pwr_limit = wiphy_chan->max_power;
-			cds_chan->flags = wiphy_chan->flags;
-
+			cds_chan->tx_power = wiphy_chan->max_power;
+			if (wiphy_chan->flags & IEEE80211_CHAN_NO_10MHZ)
+				cds_chan->max_bw = 5;
+			else if (wiphy_chan->flags & IEEE80211_CHAN_NO_20MHZ)
+				cds_chan->max_bw = 10;
+			else if (wiphy_chan->flags & IEEE80211_CHAN_NO_HT40)
+				cds_chan->max_bw = 20;
+			else if (wiphy_chan->flags & IEEE80211_CHAN_NO_80MHZ)
+				cds_chan->max_bw = 40;
+			else if (wiphy_chan->flags & IEEE80211_CHAN_NO_160MHZ)
+				cds_chan->max_bw = 80;
+			else
+				cds_chan->max_bw = 160;
 		}
 	}
 
@@ -446,9 +473,9 @@
  */
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(WITH_BACKPORTS)
 static void hdd_set_dfs_region(hdd_context_t *hdd_ctx,
-			       enum dfs_region dfs_reg)
+			       enum dfs_reg dfs_reg)
 {
-	cds_put_dfs_region(dfs_reg);
+	wlan_reg_set_dfs_region(hdd_ctx->hdd_psoc, dfs_reg);
 }
 #else
 static void hdd_set_dfs_region(hdd_context_t *hdd_ctx,
@@ -475,19 +502,20 @@
 }
 #endif
 
-
 /**
- * hdd_regulatory_init() - regulatory_init
+ * hdd_regulatory_init_no_offload() - regulatory init
  * @hdd_ctx: hdd context
  * @wiphy: wiphy
  *
  * Return: int
  */
-int hdd_regulatory_init(hdd_context_t *hdd_ctx, struct wiphy *wiphy)
+static int hdd_regulatory_init_no_offload(hdd_context_t *hdd_ctx,
+					  struct wiphy *wiphy)
 {
 	int ret_val;
 	struct regulatory *reg_info;
-	enum dfs_region dfs_reg;
+	enum dfs_reg dfs_reg;
+	struct reg_config_vars config_vars;
 
 	reg_info = &hdd_ctx->reg;
 
@@ -507,10 +535,17 @@
 
 	cds_fill_and_send_ctl_to_fw(reg_info);
 
-	hdd_set_dfs_region(hdd_ctx, DFS_FCC_REGION);
-	cds_get_dfs_region(&dfs_reg);
+	hdd_set_dfs_region(hdd_ctx, DFS_FCC_REG);
+	wlan_reg_get_dfs_region(hdd_ctx->hdd_psoc, &dfs_reg);
 	cds_set_wma_dfs_region(dfs_reg);
 
+	reg_program_config_vars(hdd_ctx, &config_vars);
+	ucfg_reg_set_config_vars(hdd_ctx->hdd_psoc, config_vars);
+	ucfg_reg_program_mas_chan_list(hdd_ctx->hdd_psoc,
+				       reg_channels,
+				       hdd_ctx->reg.alpha2,
+				       dfs_reg);
+
 	return 0;
 }
 
@@ -578,7 +613,6 @@
 }
 #endif
 
-
 /**
  * hdd_restore_reg_flags() - restore regulatory flags
  * @flags: regulatory flags
@@ -597,7 +631,6 @@
 }
 #endif
 
-
 /**
  * hdd_reg_notifier() - regulatory notifier
  * @wiphy: wiphy
@@ -610,7 +643,8 @@
 {
 	hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
 	bool reset = false;
-	enum dfs_region dfs_reg;
+	enum dfs_reg dfs_reg;
+	struct reg_config_vars config_vars;
 
 	hdd_info("country: %c%c, initiator %d, dfs_region: %d",
 		  request->alpha2[0],
@@ -641,11 +675,11 @@
 
 	if (('K' == request->alpha2[0]) &&
 	    ('R' == request->alpha2[1]))
-		request->dfs_region = DFS_KR_REGION;
+		request->dfs_region = DFS_KR_REG;
 
 	if (('C' == request->alpha2[0]) &&
 	    ('N' == request->alpha2[1]))
-		request->dfs_region = DFS_CN_REGION;
+		request->dfs_region = DFS_CN_REG;
 
 	/* first check if this callback is in response to the driver callback */
 
@@ -700,12 +734,157 @@
 		cds_fill_and_send_ctl_to_fw(&hdd_ctx->reg);
 
 		hdd_set_dfs_region(hdd_ctx, request->dfs_region);
-
-		cds_get_dfs_region(&dfs_reg);
+		wlan_reg_get_dfs_region(hdd_ctx->hdd_psoc, &dfs_reg);
 		cds_set_wma_dfs_region(dfs_reg);
+
+		reg_program_config_vars(hdd_ctx, &config_vars);
+		ucfg_reg_set_config_vars(hdd_ctx->hdd_psoc, config_vars);
+		ucfg_reg_program_mas_chan_list(hdd_ctx->hdd_psoc,
+					       reg_channels,
+					       hdd_ctx->reg.alpha2,
+					       dfs_reg);
 		break;
 
 	default:
 		break;
 	}
 }
+
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
+static void fill_wiphy_channel(struct ieee80211_channel *wiphy_chan,
+			       struct regulatory_channel *cur_chan)
+{
+
+	wiphy_chan->flags &= ~IEEE80211_CHAN_DISABLED;
+	wiphy_chan->max_power = cur_chan->tx_power;
+
+	if (cur_chan->chan_flags & REGULATORY_CHAN_DISABLED)
+		wiphy_chan->flags  |= IEEE80211_CHAN_DISABLED;
+	if (cur_chan->chan_flags & REGULATORY_CHAN_NO_IR)
+		wiphy_chan->flags  |= IEEE80211_CHAN_NO_IR;
+	if (cur_chan->chan_flags & REGULATORY_CHAN_RADAR)
+		wiphy_chan->flags  |= IEEE80211_CHAN_RADAR;
+	if (cur_chan->chan_flags & REGULATORY_CHAN_NO_OFDM)
+		wiphy_chan->flags  |= IEEE80211_CHAN_NO_OFDM;
+	if (cur_chan->chan_flags & REGULATORY_CHAN_INDOOR_ONLY)
+		wiphy_chan->flags  |= IEEE80211_CHAN_INDOOR_ONLY;
+
+	if (cur_chan->max_bw < 10)
+		wiphy_chan->flags |= IEEE80211_CHAN_NO_10MHZ;
+	if (cur_chan->max_bw < 20)
+		wiphy_chan->flags |= IEEE80211_CHAN_NO_20MHZ;
+	if (cur_chan->max_bw < 40)
+		wiphy_chan->flags |= IEEE80211_CHAN_NO_HT40;
+	if (cur_chan->max_bw < 80)
+		wiphy_chan->flags |= IEEE80211_CHAN_NO_80MHZ;
+	if (cur_chan->max_bw < 160)
+		wiphy_chan->flags |= IEEE80211_CHAN_NO_160MHZ;
+}
+
+
+static void fill_wiphy_band_channels(struct wiphy *wiphy,
+				     struct regulatory_channel *cur_chan_list,
+				     uint8_t band_id)
+{
+	uint32_t wiphy_num_chan, wiphy_index;
+	uint32_t chan_cnt;
+	struct ieee80211_channel *wiphy_chan;
+
+	wiphy_num_chan = wiphy->bands[band_id]->n_channels;
+	wiphy_chan = wiphy->bands[band_id]->channels;
+
+	for (wiphy_index = 0; wiphy_index < wiphy_num_chan; wiphy_index++) {
+		for (chan_cnt = 0; chan_cnt < NUM_CHANNELS; chan_cnt++) {
+			if (wiphy_chan[wiphy_index].center_freq ==
+			    cur_chan_list[chan_cnt].center_freq) {
+				fill_wiphy_channel(&(wiphy_chan[wiphy_index]),
+						   &(cur_chan_list[chan_cnt]));
+				break;
+			}
+		}
+	}
+}
+
+
+/**
+ * hdd_regulatory_init_offload() - regulatory init
+ * @hdd_ctx: hdd context
+ * @wiphy: wiphy
+ *
+ * Return: int
+ */
+static int hdd_regulatory_init_offload(hdd_context_t *hdd_ctx,
+				       struct wiphy *wiphy)
+{
+	struct reg_config_vars config_vars;
+	struct regulatory_channel cur_chan_list[NUM_CHANNELS];
+
+	config_vars.enable_11d_support = hdd_ctx->config->Is11dSupportEnabled;
+	config_vars.userspace_ctry_priority =
+		hdd_ctx->config->fSupplicantCountryCodeHasPriority;
+	config_vars.dfs_enabled = hdd_ctx->config->enableDFSChnlScan;
+	config_vars.indoor_chan_enabled =
+		hdd_ctx->config->indoor_channel_support;
+	config_vars.band_capability = hdd_ctx->config->nBandCapability;
+
+	reg_program_config_vars(hdd_ctx, &config_vars);
+	ucfg_reg_set_config_vars(hdd_ctx->hdd_psoc, config_vars);
+	ucfg_reg_get_current_chan_list(hdd_ctx->hdd_pdev, cur_chan_list);
+	fill_wiphy_band_channels(wiphy, cur_chan_list, NL80211_BAND_2GHZ);
+	fill_wiphy_band_channels(wiphy, cur_chan_list, NL80211_BAND_5GHZ);
+
+	return 0;
+}
+
+
+
+int hdd_regulatory_init(hdd_context_t *hdd_ctx, struct wiphy *wiphy)
+{
+	bool offload_enabled;
+	enum dfs_reg dfs_region;
+
+	offload_enabled = ucfg_reg_is_regdb_offloaded(hdd_ctx->hdd_psoc);
+
+	if (offload_enabled && hdd_ctx->config->reg_offload_enabled) {
+		hdd_ctx->reg_offload = true;
+		wiphy->reg_notifier = NULL;
+		wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
+		hdd_regulatory_init_offload(hdd_ctx, wiphy);
+
+		wlan_reg_get_dfs_region(hdd_ctx->hdd_psoc, &dfs_region);
+		cds_set_wma_dfs_region(dfs_region);
+	} else {
+		hdd_ctx->reg_offload = false;
+		wiphy->reg_notifier = hdd_reg_notifier;
+		wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS;
+		wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE;
+		hdd_regulatory_init_no_offload(hdd_ctx, wiphy);
+
+	}
+
+	return 0;
+}
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
+int hdd_regulatory_init(hdd_context_t *hdd_ctx, struct wiphy *wiphy)
+{
+	hdd_ctx->reg_offload = false;
+	wiphy->reg_notifier = hdd_reg_notifier;
+	wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS;
+	wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE;
+	hdd_regulatory_init_no_offload(hdd_ctx, wiphy);
+
+	return 0;
+}
+#else
+int hdd_regulatory_init(hdd_context_t *hdd_ctx, struct wiphy *wiphy)
+{
+	hdd_ctx->reg_offload = false;
+	wiphy->reg_notifier = hdd_reg_notifier;
+	wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS;
+	wiphy->country_ie_pref |= NL80211_COUNTRY_IE_IGNORE_CORE;
+	hdd_regulatory_init_no_offload(hdd_ctx, wiphy);
+
+	return 0;
+}
+#endif
diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c
index d70e392..7de5253 100644
--- a/core/hdd/src/wlan_hdd_wext.c
+++ b/core/hdd/src/wlan_hdd_wext.c
@@ -12479,7 +12479,7 @@
 	tHalHandle hal_hdl = hdd_ctx->hHal;
 	struct qdf_mac_addr bssid;
 	tCsrRoamProfile roam_profile;
-	struct ch_params_s ch_params;
+	struct ch_params ch_params;
 
 	if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) {
 		hdd_err("Not supported, device is not in monitor mode");
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 44dcdd4..6c334ae 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -1658,7 +1658,7 @@
 	uint16_t length;
 	uint8_t sessionId;
 	uint16_t newChannelId;
-	struct ch_params_s chan_params;
+	struct ch_params chan_params;
 	struct qdf_mac_addr bssid;      /* BSSID */
 } tSirSmeSwitchChannelInd, *tpSirSmeSwitchChannelInd;
 
@@ -3860,7 +3860,7 @@
 	uint8_t targetChannel;
 	uint8_t csaIeRequired;
 	uint8_t bssid[QDF_MAC_ADDR_SIZE];
-	struct ch_params_s ch_params;
+	struct ch_params ch_params;
 } tSirDfsCsaIeRequest, *tpSirDfsCsaIeRequest;
 
 /* Indication from lower layer indicating the completion of first beacon send
diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
index c3ab05a..1165d5a 100644
--- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
+++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
@@ -2059,7 +2059,7 @@
 		tLimWiderBWChannelSwitchInfo *chnl_switch_info,
 		tpPESession session_entry)
 {
-	struct ch_params_s ch_params = {0};
+	struct ch_params ch_params = {0};
 	uint8_t ap_new_ch_width;
 	bool new_ch_width_dfn = false;
 	uint8_t center_freq_diff;
@@ -2134,7 +2134,7 @@
 	uint8_t session_id;
 	uint16_t aid = 0;
 	uint16_t chan_space = 0;
-	struct ch_params_s ch_params;
+	struct ch_params ch_params;
 
 	tLimWiderBWChannelSwitchInfo *chnl_switch_info = NULL;
 	tLimChannelSwitchInfo *lim_ch_switch = NULL;
diff --git a/core/sap/dfs/src/dfs.c b/core/sap/dfs/src/dfs.c
index dacb8ad..01fa720 100644
--- a/core/sap/dfs/src/dfs.c
+++ b/core/sap/dfs/src/dfs.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2002-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -61,7 +61,7 @@
 #include "dfs_ioctl.h"
 #include "dfs.h"
 
-int domainoverride = DFS_UNINIT_REGION;
+int domainoverride = DFS_UNINIT_REG;
 
 /*
 ** channel switch announcement (CSA)
diff --git a/core/sap/dfs/src/dfs_process_phyerr.c b/core/sap/dfs/src/dfs_process_phyerr.c
index b385b56..bc46cda 100644
--- a/core/sap/dfs/src/dfs_process_phyerr.c
+++ b/core/sap/dfs/src/dfs_process_phyerr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2002-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -628,8 +628,8 @@
 		 *
 		 * BIN 5 chirping pulses are only for FCC or Japan MMK4 domain
 		 */
-		if (((dfs->dfsdomain == DFS_FCC_REGION) ||
-		     (dfs->dfsdomain == DFS_MKK_REGION)) &&
+		if (((dfs->dfsdomain == DFS_FCC_REG) ||
+		     (dfs->dfsdomain == DFS_MKK_REG)) &&
 		    (e.dur >= MAYBE_BIN5_DUR) && (e.dur < MAX_BIN5_DUR)) {
 			int add_dur;
 			int slope = 0, dc_found = 0;
@@ -678,8 +678,8 @@
 			 * We have a pulse that is either bigger than
 			 * MAX_BIN5_DUR or * less than MAYBE_BIN5_DUR
 			 */
-			if ((dfs->dfsdomain == DFS_FCC_REGION) ||
-			    (dfs->dfsdomain == DFS_MKK_REGION)) {
+			if ((dfs->dfsdomain == DFS_FCC_REG) ||
+			    (dfs->dfsdomain == DFS_MKK_REG)) {
 				/*
 				 * XXX Would this result in very large pulses
 				 *     wrapping around to become short pulses?
diff --git a/core/sap/dfs/src/dfs_process_radarevent.c b/core/sap/dfs/src/dfs_process_radarevent.c
index c40ada4..b86aa5d 100644
--- a/core/sap/dfs/src/dfs_process_radarevent.c
+++ b/core/sap/dfs/src/dfs_process_radarevent.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2002-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -172,7 +172,7 @@
 	   This is normally 2 but can be higher for W53.
 	 */
 
-	if ((dfs->dfsdomain == DFS_MKK_REGION) &&
+	if ((dfs->dfsdomain == DFS_MKK_REG) &&
 	    (dfs->dfs_caps.ath_chip_is_bb_tlv) &&
 	    (chan->ic_freq < FREQ_5500_MHZ)) {
 
@@ -446,8 +446,8 @@
 		 * so process the next pulse in the queue.
 		 */
 		if ((dfs->disable_dfs_ch_switch == false) &&
-			 (DFS_FCC_REGION == dfs->dfsdomain ||
-			  DFS_MKK_REGION == dfs->dfsdomain) &&
+			 (DFS_FCC_REG == dfs->dfsdomain ||
+			  DFS_MKK_REG == dfs->dfsdomain) &&
 			 (re.re_dur >= 11 && re.re_dur <= 20) &&
 			 (diff_ts > 500 || diff_ts <= 305) &&
 			 (re.sidx == -4)) {
@@ -468,8 +468,8 @@
 		 * following condition is reported in radar
 		 * summary report.
 		 */
-		if ((DFS_FCC_REGION == dfs->dfsdomain ||
-			DFS_MKK_REGION == dfs->dfsdomain) &&
+		if ((DFS_FCC_REG == dfs->dfsdomain ||
+			DFS_MKK_REG == dfs->dfsdomain) &&
 		    ((chan->ic_flags & IEEE80211_CHAN_VHT80) ==
 			IEEE80211_CHAN_VHT80) &&
 		    (chan->ic_pri_freq_center_freq_mhz_separation ==
@@ -502,7 +502,7 @@
 		 * and ETSI type 3 radar pulses when the following
 		 * condition is reported in radar summary report.
 		 */
-		if ((DFS_ETSI_REGION == dfs->dfsdomain) &&
+		if ((DFS_ETSI_REG == dfs->dfsdomain) &&
 		    ((chan->ic_flags & IEEE80211_CHAN_VHT80) ==
 			IEEE80211_CHAN_VHT80) &&
 		    (chan->ic_pri_freq_center_freq_mhz_separation ==
@@ -536,8 +536,8 @@
 
 		/* BIN5 pulses are FCC and Japan specific */
 
-		if ((dfs->dfsdomain == DFS_FCC_REGION)
-		    || (dfs->dfsdomain == DFS_MKK_REGION)) {
+		if ((dfs->dfsdomain == DFS_FCC_REG)
+		    || (dfs->dfsdomain == DFS_MKK_REG)) {
 			for (p = 0;
 			     (p < dfs->dfs_rinfo.rn_numbin5radars) && (!found);
 			     p++) {
diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h
index 862e0d6..05b08b8 100644
--- a/core/sap/inc/sap_api.h
+++ b/core/sap/inc/sap_api.h
@@ -550,7 +550,7 @@
 	struct qdf_mac_addr self_macaddr;       /* self macaddress or BSSID */
 	uint8_t channel;          /* Operation channel */
 	uint8_t sec_ch;
-	struct ch_params_s ch_params;
+	struct ch_params ch_params;
 	uint32_t ch_width_orig;
 	uint8_t max_num_sta;      /* maximum number of STAs in station table */
 	uint8_t dtim_period;      /* dtim interval */
@@ -679,7 +679,7 @@
 	 */
 	enum phy_ch_width orig_chanWidth;
 	enum phy_ch_width new_chanWidth;
-	struct ch_params_s new_ch_params;
+	struct ch_params new_ch_params;
 
 	/*
 	 * INI param to enable/disable SAP W53
diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c
index 78798be..11d38a4 100644
--- a/core/sap/src/sap_api_link_cntl.c
+++ b/core/sap/src/sap_api_link_cntl.c
@@ -245,7 +245,7 @@
 							uint32_t sec_ch)
 {
 	uint32_t channel = sap_ctx->acs_cfg->pri_ch;
-	struct ch_params_s ch_params = {0};
+	struct ch_params ch_params = {0};
 
 	ch_params.ch_width = sap_ctx->acs_cfg->ch_width;
 	cds_set_channel_params(channel, sec_ch, &ch_params);
diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c
index 53c4e66..59fd32f 100644
--- a/core/sap/src/sap_fsm.c
+++ b/core/sap/src/sap_fsm.c
@@ -1123,7 +1123,6 @@
 	tHalHandle hal = NULL;
 	tpAniSirGlobal mac = NULL;
 
-	cds_get_dfs_region(dfs_region);
 	if (!sap_ctx) {
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
 			  "%s: null sap_ctx", __func__);
@@ -1145,7 +1144,9 @@
 		return;
 	}
 
-	if ((*dfs_region == DFS_ETSI_REGION) &&
+	wlan_reg_get_dfs_region(mac->psoc, dfs_region);
+
+	if ((*dfs_region == DFS_ETSI_REG) &&
 	    ((IS_ETSI_WEATHER_CH(sap_ctx->channel)) ||
 	    (sap_is_channel_bonding_etsi_weather_channel(sap_ctx))))
 		*cac_duration_ms = ETSI_WEATHER_CH_CAC_TIMEOUT;
@@ -1404,7 +1405,7 @@
 	tpAniSirGlobal mac_ctx;
 	tHalHandle hal = CDS_GET_HAL_CB(sap_ctx->p_cds_gctx);
 	uint8_t preferred_location;
-	enum dfs_region dfs_region;
+	enum dfs_reg dfs_region;
 
 	if (NULL == hal) {
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
@@ -1421,7 +1422,7 @@
 
 	preferred_location =
 		mac_ctx->sap.SapDfsInfo.sap_operating_chan_preferred_location;
-	cds_get_dfs_region(&dfs_region);
+	wlan_reg_get_dfs_region(mac_ctx->psoc, &dfs_region);
 	/* loop to check ACS range or NOL channels */
 	num_valid_ch = sap_all_ch->numChannel;
 	for (i = 0; i < sap_all_ch->numChannel; i++) {
@@ -1444,7 +1445,7 @@
 		 * channels only based up on the SAP Channel location
 		 * indicated by "sap_operating_channel_location" param.
 		 */
-		if (DFS_MKK_REGION == dfs_region) {
+		if (DFS_MKK_REG == dfs_region) {
 			/*
 			 * Check for JAPAN W53 Channel operation capability
 			 */
@@ -5176,7 +5177,7 @@
 	uint32_t cac_dur;
 	tHalHandle hal = NULL;
 	tpAniSirGlobal mac = NULL;
-	enum dfs_region dfs_region;
+	enum dfs_reg dfs_region;
 
 	if (!sap_ctx) {
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
@@ -5203,6 +5204,12 @@
 	if (0 == cac_dur)
 		return 0;
 
+	if ((dfs_region == DFS_ETSI_REG) &&
+	    ((IS_ETSI_WEATHER_CH(sap_ctx->channel)) ||
+	     (sap_is_channel_bonding_etsi_weather_channel(sap_ctx)))) {
+		cac_dur = ETSI_WEATHER_CH_CAC_TIMEOUT;
+	}
+
 #ifdef QCA_WIFI_NAPIER_EMULATION
 	cac_dur = cac_dur / 100;
 #endif
diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h
index 7f56f36..74634ce 100644
--- a/core/sap/src/sap_internal.h
+++ b/core/sap/src/sap_internal.h
@@ -215,7 +215,7 @@
 	uint8_t num_of_channel;
 	tSapChannelListInfo SapChnlList;
 	uint16_t ch_width_orig;
-	struct ch_params_s ch_params;
+	struct ch_params ch_params;
 
 	/* session to scan */
 	bool isScanSessionOpen;
diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c
index 9cb8aab..d58deab 100644
--- a/core/sap/src/sap_module.c
+++ b/core/sap/src/sap_module.c
@@ -2701,7 +2701,7 @@
 	void *hHal = NULL;
 	tpAniSirGlobal mac_ctx = NULL;
 	eCsrPhyMode phy_mode;
-	struct ch_params_s *ch_params;
+	struct ch_params *ch_params;
 	sapContext = (ptSapContext) pSapCtx;
 
 	if (NULL == sapContext) {
@@ -2990,7 +2990,7 @@
 {
 	tpAniSirGlobal pMac = NULL;
 	QDF_STATUS status;
-	enum dfs_region dfs_region;
+	enum dfs_reg dfs_region;
 
 	if (NULL != hHal) {
 		pMac = PMAC_STRUCT(hHal);
@@ -3000,13 +3000,13 @@
 		return QDF_STATUS_E_FAULT;
 	}
 
-	cds_get_dfs_region(&dfs_region);
+	wlan_reg_get_dfs_region(pMac->psoc, &dfs_region);
 
 	/*
 	 * Set the JAPAN W53 restriction only if the current
 	 * regulatory domain is JAPAN.
 	 */
-	if (DFS_MKK_REGION == dfs_region) {
+	if (DFS_MKK_REG == dfs_region) {
 		pMac->sap.SapDfsInfo.is_dfs_w53_disabled = disable_Dfs_W53;
 		QDF_TRACE(QDF_MODULE_ID_SAP,
 			  QDF_TRACE_LEVEL_INFO_LOW,
@@ -3086,7 +3086,7 @@
 {
 	tpAniSirGlobal pMac = NULL;
 	QDF_STATUS status;
-	enum dfs_region dfs_region;
+	enum dfs_reg dfs_region;
 
 	if (NULL != hHal) {
 		pMac = PMAC_STRUCT(hHal);
@@ -3096,14 +3096,14 @@
 		return QDF_STATUS_E_FAULT;
 	}
 
-	cds_get_dfs_region(&dfs_region);
+	wlan_reg_get_dfs_region(pMac->psoc, &dfs_region);
 
 	/*
 	 * The Indoor/Outdoor only random channel selection
 	 * restriction is currently enforeced only for
 	 * JAPAN regulatory domain.
 	 */
-	if (DFS_MKK_REGION == dfs_region) {
+	if (DFS_MKK_REG == dfs_region) {
 		pMac->sap.SapDfsInfo.sap_operating_chan_preferred_location =
 			dfs_Preferred_Channels_location;
 		QDF_TRACE(QDF_MODULE_ID_SAP,
diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h
index 65bc613..0f93e23 100644
--- a/core/sme/inc/csr_api.h
+++ b/core/sme/inc/csr_api.h
@@ -916,7 +916,7 @@
 	eCsrCBChoice CBMode;
 	tCsrChannelInfo ChannelInfo;
 	uint8_t operationChannel;
-	struct ch_params_s ch_params;
+	struct ch_params ch_params;
 	/* If this is 0, SME will fill in for caller. */
 	uint16_t beaconInterval;
 	/*
diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h
index f62241f..5e7591d 100644
--- a/core/sme/inc/csr_internal.h
+++ b/core/sme/inc/csr_internal.h
@@ -323,7 +323,7 @@
 	tSirMacRateSet operationalRateSet;
 	tSirMacRateSet extendedRateSet;
 	uint8_t operationChn;
-	struct ch_params_s ch_params;
+	struct ch_params ch_params;
 	eCsrCfgDot11Mode uCfgDot11Mode;
 	uint8_t privacy;
 	bool fwdWPSPBCProbeReq;
@@ -1322,7 +1322,7 @@
 
 /* Post Channel Change Indication */
 QDF_STATUS csr_roam_channel_change_req(tpAniSirGlobal pMac, struct qdf_mac_addr
-				       bssid, struct ch_params_s *ch_params,
+				       bssid, struct ch_params *ch_params,
 				       tCsrRoamProfile *profile);
 
 /* Post Beacon Tx Start Indication */
@@ -1333,7 +1333,7 @@
 					    struct qdf_mac_addr bssid,
 					    uint8_t targetChannel,
 					    uint8_t csaIeReqd,
-					    struct ch_params_s *ch_params);
+					    struct ch_params *ch_params);
 QDF_STATUS csr_roam_modify_add_ies(tpAniSirGlobal pMac, tSirModifyIE *pModifyIE,
 				   eUpdateIEsType updateType);
 QDF_STATUS
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index d74914f..2c1118c 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -785,14 +785,14 @@
 #endif
 QDF_STATUS sme_roam_channel_change_req(tHalHandle hHal,
 				       struct qdf_mac_addr bssid,
-				       struct ch_params_s *ch_params,
+				       struct ch_params *ch_params,
 				       tCsrRoamProfile *profile);
 
 QDF_STATUS sme_roam_start_beacon_req(tHalHandle hHal,
 		struct qdf_mac_addr bssid, uint8_t dfsCacWaitStatus);
 QDF_STATUS sme_roam_csa_ie_request(tHalHandle hHal, struct qdf_mac_addr bssid,
 				   uint8_t targetChannel, uint8_t csaIeReqd,
-				   struct ch_params_s *ch_params);
+				   struct ch_params *ch_params);
 
 QDF_STATUS sme_init_thermal_info(tHalHandle hHal,
 				 tSmeThermalParams thermalParam);
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 1476126..4314720 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -11411,10 +11411,10 @@
 	for (i = 0; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++) {
 		if (pMac->scan.defaultPowerTable[i].chan_num == chanId) {
 			SME_SET_CHANNEL_REG_POWER(*regInfo1,
-				pMac->scan.defaultPowerTable[i].power);
+				pMac->scan.defaultPowerTable[i].tx_power);
 
 			SME_SET_CHANNEL_MAX_TX_POWER(*regInfo2,
-				pMac->scan.defaultPowerTable[i].power);
+				pMac->scan.defaultPowerTable[i].tx_power);
 			found = true;
 			break;
 		}
@@ -11677,7 +11677,7 @@
  */
 QDF_STATUS sme_roam_channel_change_req(tHalHandle hHal,
 				       struct qdf_mac_addr bssid,
-				       struct ch_params_s *ch_params,
+				       struct ch_params *ch_params,
 				       tCsrRoamProfile *profile)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
@@ -11786,7 +11786,7 @@
  */
 QDF_STATUS sme_roam_csa_ie_request(tHalHandle hHal, struct qdf_mac_addr bssid,
 				uint8_t targetChannel, uint8_t csaIeReqd,
-				struct ch_params_s *ch_params)
+				struct ch_params *ch_params)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c
index d5a1f5b..2947f8e 100644
--- a/core/sme/src/csr/csr_api_roam.c
+++ b/core/sme/src/csr/csr_api_roam.c
@@ -432,7 +432,7 @@
 			pMac->scan.base_channels.channelList[index];
 		pParam->Csr11dinfo.ChnPower[index].numChannels = 1;
 		pParam->Csr11dinfo.ChnPower[index].maxtxPower =
-			pMac->scan.defaultPowerTable[index].power;
+			pMac->scan.defaultPowerTable[index].tx_power;
 	}
 	pParam->Csr11dinfo.Channels.numChannels =
 		pMac->scan.base_channels.numChannels;
@@ -466,7 +466,7 @@
 	/* order of channel numbers, we can employ binary search */
 	for (i = 0; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++) {
 		if (pdefaultPowerTable[i].chan_num == ChannelNum)
-			return pdefaultPowerTable[i].power;
+			return pdefaultPowerTable[i].tx_power;
 	}
 	/* could not find the channel list in default list */
 	/* this should not have occured */
@@ -752,8 +752,10 @@
 			continue;
 
 		/* Scan is not performed on DSRC channels*/
-		if (pScan->base_channels.channelList[i] >= CDS_MIN_11P_CHANNEL)
+		if (pScan->base_channels.channelList[i] >=
+		    WLAN_REG_MIN_11P_CH_NUM)
 			continue;
+
 		channel = pScan->base_channels.channelList[i];
 
 		channel_state =
@@ -19069,7 +19071,7 @@
  */
 QDF_STATUS csr_roam_channel_change_req(tpAniSirGlobal pMac,
 				       struct qdf_mac_addr bssid,
-				       struct ch_params_s *ch_params,
+				       struct ch_params *ch_params,
 				       tCsrRoamProfile *profile)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
@@ -19313,7 +19315,7 @@
 					    struct qdf_mac_addr bssid,
 					    uint8_t target_channel,
 					    uint8_t csa_ie_reqd,
-					    struct ch_params_s *ch_params)
+					    struct ch_params *ch_params)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	tSirDfsCsaIeRequest *msg;
@@ -19329,7 +19331,7 @@
 	msg->targetChannel = target_channel;
 	msg->csaIeRequired = csa_ie_reqd;
 	qdf_mem_copy(msg->bssid, bssid.bytes, QDF_MAC_ADDR_SIZE);
-	qdf_mem_copy(&msg->ch_params, ch_params, sizeof(struct ch_params_s));
+	qdf_mem_copy(&msg->ch_params, ch_params, sizeof(struct ch_params));
 
 	status = umac_send_mb_message_to_mac(msg);
 
diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c
index 62f103b..25ad292 100644
--- a/core/sme/src/csr/csr_api_scan.c
+++ b/core/sme/src/csr/csr_api_scan.c
@@ -3467,7 +3467,7 @@
 		     Index < pMac->scan.base_channels.numChannels;
 		     Index++) {
 			p11dLog->TxPwr[Index] = QDF_MIN(
-				pMac->scan.defaultPowerTable[Index].power,
+				pMac->scan.defaultPowerTable[Index].tx_power,
 				pMac->roam.configParam.nTxPowerCap);
 		}
 	}
@@ -3662,7 +3662,7 @@
 			chn_pwr_info[chn_idx].chan_num =
 				(uint8_t) (ch_set->firstChannel
 				 + (idx * ch_set->interChannelOffset));
-			chn_pwr_info[chn_idx++].power = ch_set->txPower;
+			chn_pwr_info[chn_idx++].tx_power = ch_set->txPower;
 		}
 		entry = csr_ll_next(list, entry, LL_ACCESS_LOCK);
 	}
@@ -3707,7 +3707,7 @@
 			if (p11dLog->Channels[nTmp] ==
 			    chnPwrInfo[nChnInfo].chan_num) {
 				p11dLog->TxPwr[nTmp] =
-					chnPwrInfo[nChnInfo].power;
+					chnPwrInfo[nChnInfo].tx_power;
 				break;
 			}
 		}
@@ -3798,7 +3798,7 @@
 			pMac->scan.defaultPowerTable[idx].chan_num;
 		chan_info->numChannels = 1;
 		chan_info->maxTxPower =
-			QDF_MIN(pMac->scan.defaultPowerTable[idx].power,
+			QDF_MIN(pMac->scan.defaultPowerTable[idx].tx_power,
 				pMac->roam.configParam.nTxPowerCap);
 		chan_info++;
 		count++;
@@ -5818,11 +5818,11 @@
 		 * This can happen only if band is set to 5Ghz mode.
 		 */
 		if (src_req->ChannelInfo.ChannelList[index] <
-		    CDS_MIN_11P_CHANNEL &&
-			((csr_roam_is_valid_channel(mac_ctx,
-			src_req->ChannelInfo.ChannelList[index])) ||
-			((eCSR_SCAN_P2P_DISCOVERY == src_req->requestType) &&
-			CSR_IS_SOCIAL_CHANNEL(
+		    WLAN_REG_MIN_11P_CH_NUM &&
+		    ((csr_roam_is_valid_channel(mac_ctx,
+		     src_req->ChannelInfo.ChannelList[index])) ||
+		     ((eCSR_SCAN_P2P_DISCOVERY == src_req->requestType) &&
+		      CSR_IS_SOCIAL_CHANNEL(
 				src_req->ChannelInfo.ChannelList[index])))) {
 			if (((src_req->skipDfsChnlInP2pSearch || skip_dfs_chnl)
 				&& (CHANNEL_STATE_DFS ==
@@ -5929,12 +5929,9 @@
 				valid_chnl_len);
 	}
 	for (i = 0; i < valid_chnl_len; i++) {
-		/*
-		 * Don't allow DSRC channel when IBSS or SAP DFS concurrent
-		 * connection is up
-		 */
-		if (valid_chnl_list[i] >= CDS_MIN_11P_CHANNEL)
+		if (valid_chnl_list[i] >= WLAN_REG_MIN_11P_CH_NUM)
 			continue;
+
 		if (CDS_IS_CHANNEL_5GHZ(channel) &&
 			CDS_IS_CHANNEL_24GHZ(valid_chnl_list[i])) {
 			valid_chnl_list[filter_chnl_len] =
@@ -6044,8 +6041,8 @@
 							ChannelInfo.
 							ChannelList[index]);
 				if (src_req->ChannelInfo.ChannelList[index] <
-						CDS_MIN_11P_CHANNEL &&
-					((CHANNEL_STATE_ENABLE ==
+				    WLAN_REG_MIN_11P_CH_NUM &&
+				    ((CHANNEL_STATE_ENABLE ==
 						channel_state) ||
 					((CHANNEL_STATE_DFS == channel_state) &&
 					!skip_dfs_chnl))) {
@@ -6075,7 +6072,7 @@
 			for (index = 0; index < src_req->ChannelInfo.
 					numOfChannels; index++) {
 				if (src_req->ChannelInfo.ChannelList[index] <
-						CDS_MIN_11P_CHANNEL) {
+				    WLAN_REG_MIN_11P_CH_NUM) {
 					dst_req->ChannelInfo.
 						ChannelList[new_index] =
 						src_req->ChannelInfo.
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index f16f9f2..f19a911 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -2169,7 +2169,7 @@
 				   uint32_t len);
 int wma_mgmt_tx_bundle_completion_handler(void *handle,
 	uint8_t *cmpl_event_params, uint32_t len);
-void wma_set_dfs_region(tp_wma_handle wma, enum dfs_region dfs_region);
+void wma_set_dfs_region(tp_wma_handle wma, enum dfs_reg dfs_region);
 uint32_t wma_get_vht_ch_width(void);
 QDF_STATUS
 wma_config_debug_module_cmd(wmi_unified_t wmi_handle, A_UINT32 param,
diff --git a/core/wma/inc/wma_dfs_interface.h b/core/wma/inc/wma_dfs_interface.h
index 0588061..6ea1640 100644
--- a/core/wma/inc/wma_dfs_interface.h
+++ b/core/wma/inc/wma_dfs_interface.h
@@ -264,7 +264,7 @@
 	int (*ic_dfs_control)(struct ieee80211com *ic,
 			      u_int id, void *indata, uint32_t insize,
 			      void *outdata, uint32_t *outsize);
-	enum dfs_region current_dfs_regdomain;
+	enum dfs_reg current_dfs_regdomain;
 	uint8_t vdev_id;
 	uint8_t last_radar_found_chan;
 	int32_t dfs_pri_multiplier;
diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c
index 8353af9..b64a12f 100644
--- a/core/wma/src/wma_dev_if.c
+++ b/core/wma/src/wma_dev_if.c
@@ -2016,7 +2016,7 @@
 			 * early on, to protect the DFS module from
 			 * processing phyerrors without being intialized.
 			 */
-			if (DFS_UNINIT_REGION ==
+			if (DFS_UNINIT_REG ==
 			    wma->dfs_ic->current_dfs_regdomain) {
 				WMA_LOGE("%s[%d]:DFS Configured with Invalid regdomain"
 					" Failed to send VDEV START command",
diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c
index e9d9940..8d6c4a2 100644
--- a/core/wma/src/wma_features.c
+++ b/core/wma/src/wma_features.c
@@ -606,7 +606,7 @@
 				break;
 			}
 		}
-	} else if (CDS_IS_CHANNEL_DSRC(chan))
+	} else if (WLAN_REG_IS_11P_CH(chan))
 		phymode = MODE_11A;
 	else {
 		if (((CH_WIDTH_5MHZ == chan_width) ||
@@ -5009,41 +5009,41 @@
 	 * which radar pulses to use.
 	 */
 	switch (dfsdomain) {
-	case DFS_FCC_REGION:
+	case DFS_FCC_REG:
 		WMA_LOGI("%s: DFS-FCC domain", __func__);
-		rinfo.dfsdomain = DFS_FCC_REGION;
+		rinfo.dfsdomain = DFS_FCC_REG;
 		rinfo.dfs_radars = dfs_fcc_radars;
 		rinfo.numradars = QDF_ARRAY_SIZE(dfs_fcc_radars);
 		rinfo.b5pulses = dfs_fcc_bin5pulses;
 		rinfo.numb5radars = QDF_ARRAY_SIZE(dfs_fcc_bin5pulses);
 		break;
-	case DFS_ETSI_REGION:
+	case DFS_ETSI_REG:
 		WMA_LOGI("%s: DFS-ETSI domain", __func__);
-		rinfo.dfsdomain = DFS_ETSI_REGION;
+		rinfo.dfsdomain = DFS_ETSI_REG;
 		rinfo.dfs_radars = dfs_etsi_radars;
 		rinfo.numradars = QDF_ARRAY_SIZE(dfs_etsi_radars);
 		rinfo.b5pulses = NULL;
 		rinfo.numb5radars = 0;
 		break;
-	case DFS_MKK_REGION:
+	case DFS_MKK_REG:
 		WMA_LOGI("%s: DFS-MKK domain", __func__);
-		rinfo.dfsdomain = DFS_MKK_REGION;
+		rinfo.dfsdomain = DFS_MKK_REG;
 		rinfo.dfs_radars = dfs_mkk4_radars;
 		rinfo.numradars = QDF_ARRAY_SIZE(dfs_mkk4_radars);
 		rinfo.b5pulses = dfs_jpn_bin5pulses;
 		rinfo.numb5radars = QDF_ARRAY_SIZE(dfs_jpn_bin5pulses);
 		break;
-	case DFS_CN_REGION:
+	case DFS_CN_REG:
 		WMA_LOGI("%s: DFS-CN domain", __func__);
-		rinfo.dfsdomain = DFS_CN_REGION;
+		rinfo.dfsdomain = DFS_CN_REG;
 		rinfo.dfs_radars = dfs_china_radars;
 		rinfo.numradars = QDF_ARRAY_SIZE(dfs_china_radars);
 		rinfo.b5pulses = NULL;
 		rinfo.numb5radars = 0;
 		break;
-	case DFS_KR_REGION:
+	case DFS_KR_REG:
 		WMA_LOGI("%s: DFS-KR domain", __func__);
-		rinfo.dfsdomain = DFS_KR_REGION;
+		rinfo.dfsdomain = DFS_KR_REG;
 		rinfo.dfs_radars = dfs_korea_radars;
 		rinfo.numradars = QDF_ARRAY_SIZE(dfs_korea_radars);
 		rinfo.b5pulses = NULL;
@@ -5051,7 +5051,7 @@
 		break;
 	default:
 		WMA_LOGI("%s: DFS-UNINT domain", __func__);
-		rinfo.dfsdomain = DFS_UNINIT_REGION;
+		rinfo.dfsdomain = DFS_UNINIT_REG;
 		rinfo.dfs_radars = NULL;
 		rinfo.numradars = 0;
 		rinfo.b5pulses = NULL;
@@ -5207,13 +5207,13 @@
  *
  * Return: none
  */
-void wma_set_dfs_region(tp_wma_handle wma, enum dfs_region dfs_region)
+void wma_set_dfs_region(tp_wma_handle wma, enum dfs_reg dfs_region)
 {
-	if (dfs_region >= DFS_UNDEF_REGION ||
-	    dfs_region == DFS_UNINIT_REGION)
+	if (dfs_region >= DFS_UNDEF_REG ||
+	    dfs_region == DFS_UNINIT_REG)
 
 		/* assign DFS_FCC_REGION as default region*/
-		wma->dfs_ic->current_dfs_regdomain = DFS_FCC_REGION;
+		wma->dfs_ic->current_dfs_regdomain = DFS_FCC_REG;
 	else
 		wma->dfs_ic->current_dfs_regdomain = dfs_region;