diff --git a/core/cds/inc/cds_reg_service.h b/core/cds/inc/cds_reg_service.h index 7a87e942fa83..4fc7a5223b4a 100644 --- a/core/cds/inc/cds_reg_service.h +++ b/core/cds/inc/cds_reg_service.h @@ -343,6 +343,26 @@ struct ch_params_s { 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]; @@ -357,8 +377,8 @@ QDF_STATUS cds_get_channel_list_with_power(struct channel_power uint8_t *num_base_channels); enum channel_state cds_get_channel_state(uint32_t chan_num); -QDF_STATUS cds_get_dfs_region(uint8_t *dfs_region); -QDF_STATUS cds_put_dfs_region(uint8_t dfs_region); +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, diff --git a/core/cds/inc/cds_regdomain.h b/core/cds/inc/cds_regdomain.h index d1c134d0ced7..ac202b7f1dc1 100644 --- a/core/cds/inc/cds_regdomain.h +++ b/core/cds/inc/cds_regdomain.h @@ -472,20 +472,6 @@ enum ctl_val { NO_CTL = 0xff }; -/** - * 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 - */ -enum dfs_region { - DFS_UNINIT_REGION = 0, - DFS_FCC_REGION = 1, - DFS_ETSI_REGION = 2, - DFS_MKK_REGION = 3 -}; - /** * enum offset_t: channel offset * @BW20: 20 mhz channel diff --git a/core/cds/src/cds_reg_service.c b/core/cds/src/cds_reg_service.c index b15f99fef296..32cfc719d767 100644 --- a/core/cds/src/cds_reg_service.c +++ b/core/cds/src/cds_reg_service.c @@ -40,6 +40,7 @@ #include "cds_reg_service.h" #include "cds_regdomain.h" + const struct chan_map chan_mapping[NUM_CHANNELS] = { [CHAN_ENUM_1] = {2412, 1}, [CHAN_ENUM_2] = {2417, 2}, @@ -152,7 +153,7 @@ static const enum phy_ch_width next_lower_bw[] = { struct regulatory_channel reg_channels[NUM_CHANNELS]; static uint8_t default_country[CDS_COUNTRY_CODE_LEN + 1]; -static uint8_t dfs_region; +static enum dfs_region dfs_region; /** * cds_get_channel_list_with_power() - retrieve channel list with power @@ -580,7 +581,7 @@ void cds_set_channel_params(uint16_t oper_ch, uint16_t sec_ch_2g, * * Return: QDF_STATUS */ -QDF_STATUS cds_get_dfs_region(uint8_t *dfs_reg) +QDF_STATUS cds_get_dfs_region(enum dfs_region *dfs_reg) { *dfs_reg = dfs_region; @@ -670,7 +671,7 @@ QDF_STATUS cds_set_reg_domain(void *client_ctxt, v_REGDOMAIN_t reg_domain) * * Return: QDF_STATUS */ -QDF_STATUS cds_put_dfs_region(uint8_t dfs_reg) +QDF_STATUS cds_put_dfs_region(enum dfs_region dfs_reg) { dfs_region = dfs_reg; diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 6f7457ebe09b..4a33cf8793e2 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -33,10 +33,10 @@ #include "qdf_types.h" #include "cds_reg_service.h" +#include "cds_regdomain.h" #include "qdf_trace.h" #include "sme_api.h" #include "wlan_hdd_main.h" -#include "cds_regdomain.h" #include "wlan_hdd_regulatory.h" #define WORLD_SKU_MASK 0x00F0 @@ -427,6 +427,43 @@ static void hdd_process_regulatory_data(hdd_context_t *hdd_ctx, wlan_hdd_cfg80211_update_band(wiphy, band_capability); } +/** + * hdd_set_dfs_region() - set the dfs_region + * @dfs_region: the dfs_region to set + * + * Return: void + */ +#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) +{ + cds_put_dfs_region(dfs_reg); +} +#else +static void hdd_set_dfs_region(hdd_context_t *hdd_ctx, + enum dfs_region dfs_reg) +{ + + /* remap the ctl code to dfs region code */ + switch (hdd_ctx->reg.ctl_5g) { + case FCC: + cds_put_dfs_region(DFS_FCC_REGION); + break; + case ETSI: + cds_put_dfs_region(DFS_ETSI_REGION); + break; + case MKK: + cds_put_dfs_region(DFS_MKK_REGION); + break; + default: + /* set default dfs_region to FCC */ + cds_put_dfs_region(DFS_FCC_REGION); + break; + } + +} +#endif + /** * hdd_regulatory_init() - regulatory_init @@ -439,6 +476,7 @@ int hdd_regulatory_init(hdd_context_t *hdd_ctx, struct wiphy *wiphy) { int ret_val; struct regulatory *reg_info; + enum dfs_region dfs_reg; reg_info = &hdd_ctx->reg; @@ -460,6 +498,10 @@ int hdd_regulatory_init(hdd_context_t *hdd_ctx, struct wiphy *wiphy) cds_fill_and_send_ctl_to_fw(reg_info); + hdd_set_dfs_region(hdd_ctx, DFS_FCC_REGION); + cds_get_dfs_region(&dfs_reg); + cds_set_wma_dfs_region(dfs_reg); + return 0; } @@ -487,43 +529,6 @@ void hdd_program_country_code(hdd_context_t *hdd_ctx) } -/** - * hdd_set_dfs_region() - set the dfs_region - * @dfs_region: the dfs_region to set - * - * Return: void - */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(WITH_BACKPORTS) -static void hdd_set_dfs_region(hdd_context_t *hdd_ctx, - uint8_t dfs_reg) -{ - cds_put_dfs_region(dfs_reg); -} -#else -static void hdd_set_dfs_region(hdd_context_t *hdd_ctx, - uint8_t dfs_reg) -{ - - /* remap the ctl code to dfs region code */ - switch (hdd_ctx->reg.ctl_5g) { - case FCC: - cds_put_dfs_region(DFS_FCC_REGION); - break; - case ETSI: - cds_put_dfs_region(DFS_ETSI_REGION); - break; - case MKK: - cds_put_dfs_region(DFS_MKK_REGION); - break; - default: - /* set default dfs_region to FCC */ - cds_put_dfs_region(DFS_FCC_REGION); - break; - } - -} -#endif - /** * hdd_restore_custom_reg_settings() - restore custom reg settings * @wiphy: wiphy structure @@ -601,7 +606,7 @@ void hdd_reg_notifier(struct wiphy *wiphy, hdd_context_t *hdd_ctx = wiphy_priv(wiphy); bool vht80_allowed; bool reset = false; - uint8_t dfs_reg; + enum dfs_region dfs_reg; hdd_info("country: %c%c, initiator %d, dfs_region: %d", request->alpha2[0], @@ -620,6 +625,14 @@ void hdd_reg_notifier(struct wiphy *wiphy, return; } + if (('K' == request->alpha2[0]) && + ('R' == request->alpha2[1])) + request->dfs_region = DFS_KR_REGION; + + if (('C' == request->alpha2[0]) && + ('N' == request->alpha2[1])) + request->dfs_region = DFS_CN_REGION; + /* first check if this callback is in response to the driver callback */ switch (request->initiator) { diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 07376204d032..7135232557f4 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -1246,13 +1246,14 @@ bool sap_check_in_avoid_ch_list(ptSapContext sap_ctx, uint8_t channel) */ static uint8_t sap_apply_rules(ptSapContext sap_ctx) { - uint8_t num_valid_ch, dfs_region, i = 0, ch_id; + uint8_t num_valid_ch, i = 0, ch_id; tAll5GChannelList *sap_all_ch = &sap_ctx->SapAllChnlList; bool is_ch_nol = false; bool is_out_of_range = false; tpAniSirGlobal mac_ctx; tHalHandle hal = CDS_GET_HAL_CB(sap_ctx->p_cds_gctx); uint8_t preferred_location; + enum dfs_region dfs_region; if (NULL == hal) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, @@ -4853,7 +4854,7 @@ int sap_start_dfs_cac_timer(ptSapContext sapContext) uint32_t cacTimeOut; tHalHandle hHal = NULL; tpAniSirGlobal pMac = NULL; - uint8_t dfs_region; + enum dfs_region dfs_region; if (sapContext == NULL) { return 0; diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 7a77d1963aa1..edb3aa27ef2f 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -2871,7 +2871,7 @@ wlansap_set_dfs_restrict_japan_w53(tHalHandle hHal, uint8_t disable_Dfs_W53) { tpAniSirGlobal pMac = NULL; QDF_STATUS status; - uint8_t dfs_region; + enum dfs_region dfs_region; if (NULL != hHal) { pMac = PMAC_STRUCT(hHal); @@ -2955,7 +2955,7 @@ wlansap_set_dfs_preferred_channel_location(tHalHandle hHal, { tpAniSirGlobal pMac = NULL; QDF_STATUS status; - uint8_t dfs_region; + enum dfs_region dfs_region; if (NULL != hHal) { pMac = PMAC_STRUCT(hHal); diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 1665af613c16..d915c88a95b3 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -2112,7 +2112,7 @@ int wma_mgmt_tx_completion_handler(void *handle, uint8_t *cmpl_event_params, 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, uint8_t dfs_region); +void wma_set_dfs_region(tp_wma_handle wma, enum dfs_region 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/src/wma_features.c b/core/wma/src/wma_features.c index f2c8a87ad3a2..5ed1ff95eb8b 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -7199,10 +7199,11 @@ struct dfs_ieee80211_channel *wma_dfs_configure_channel( * * Return: none */ -void wma_set_dfs_region(tp_wma_handle wma, uint8_t dfs_region) +void wma_set_dfs_region(tp_wma_handle wma, enum dfs_region dfs_region) { - /* dfs information is passed */ - if (dfs_region > DFS_MKK_REGION || dfs_region == DFS_UNINIT_REGION) + if (dfs_region >= DFS_UNDEF_REGION || + dfs_region == DFS_UNINIT_REGION) + /* assign DFS_FCC_REGION as default region*/ wma->dfs_ic->current_dfs_regdomain = DFS_FCC_REGION; else