summaryrefslogtreecommitdiff
path: root/umac
diff options
context:
space:
mode:
authorAmar Singhal <asinghal@codeaurora.org>2018-01-30 15:37:36 +0800
committersnandini <snandini@codeaurora.org>2018-02-10 00:52:18 -0800
commit40126d4847bbd7decb55e6187c79521e1ad890ee (patch)
tree114c7139aeff7561c0d093eb665c602fab4767bc /umac
parentd1d26229a8be68cf1f9153717aa3847477da19d2 (diff)
downloadqca-wfi-host-cmn-40126d4847bbd7decb55e6187c79521e1ad890ee.tar.gz
qcacmn: Check world mode when setting country code
When setting country code dynamically, world mode is variable. Multiple world modes are supported depending on the BDF configuration. Currently, it does not check the world mode when setting country code and not take appropriate action. Change-Id: Ibd087825dbdba58d3d52d0c208edf183e3088731 CRs-Fixed: 2182129
Diffstat (limited to 'umac')
-rw-r--r--umac/regulatory/core/src/reg_priv.h5
-rw-r--r--umac/regulatory/core/src/reg_services.c59
-rw-r--r--umac/regulatory/dispatcher/inc/reg_services_public_struct.h6
3 files changed, 65 insertions, 5 deletions
diff --git a/umac/regulatory/core/src/reg_priv.h b/umac/regulatory/core/src/reg_priv.h
index ffa2c7525..fd6a48235 100644
--- a/umac/regulatory/core/src/reg_priv.h
+++ b/umac/regulatory/core/src/reg_priv.h
@@ -51,10 +51,13 @@ struct wlan_regulatory_psoc_priv_obj {
uint8_t num_phy;
char cur_country[REG_ALPHA2_LEN + 1];
char def_country[REG_ALPHA2_LEN + 1];
+ uint16_t def_country_code;
+ uint16_t def_region_domain;
enum country_src cc_src;
struct wlan_objmgr_psoc *psoc_ptr;
bool new_user_ctry_pending;
bool new_11d_ctry_pending;
+ bool world_country_pending;
bool dfs_enabled;
enum band_info band_capability;
bool indoor_chan_enabled;
@@ -83,6 +86,8 @@ struct wlan_regulatory_pdev_priv_obj {
struct regulatory_channel cur_chan_list[NUM_CHANNELS];
struct regulatory_channel mas_chan_list[NUM_CHANNELS];
char default_country[REG_ALPHA2_LEN + 1];
+ uint16_t def_region_domain;
+ uint16_t def_country_code;
char current_country[REG_ALPHA2_LEN + 1];
uint16_t reg_dmn_pair;
uint16_t ctry_code;
diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c
index 7031c975a..c707b73ed 100644
--- a/umac/regulatory/core/src/reg_services.c
+++ b/umac/regulatory/core/src/reg_services.c
@@ -40,6 +40,7 @@
#define CHAN_13_CENT_FREQ 2472
#define MAX_PWR_FCC_CHAN_13 2
#define CHAN_144_CENT_FREQ 5720
+#define DEFAULT_WORLD_REGDMN 0x60
#define IS_VALID_PSOC_REG_OBJ(psoc_priv_obj) (NULL != psoc_priv_obj)
#define IS_VALID_PDEV_REG_OBJ(pdev_priv_obj) (NULL != pdev_priv_obj)
@@ -1303,6 +1304,15 @@ QDF_STATUS reg_get_curr_band(struct wlan_objmgr_pdev *pdev,
return QDF_STATUS_SUCCESS;
}
+static bool
+reg_is_world_ctry_code(uint16_t ctry_code)
+{
+ if ((ctry_code & 0xFFF0) == DEFAULT_WORLD_REGDMN)
+ return true;
+
+ return false;
+}
+
QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc,
uint8_t *country_code)
{
@@ -1397,6 +1407,7 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
uint8_t *country)
{
struct wlan_regulatory_psoc_priv_obj *psoc_reg;
+ struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
struct wlan_lmac_if_reg_tx_ops *tx_ops;
struct set_country country_code;
struct wlan_objmgr_psoc *psoc;
@@ -1427,7 +1438,10 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
country, REG_ALPHA2_LEN + 1);
country_code.pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
- psoc_reg->new_user_ctry_pending = true;
+ if (reg_is_world_alpha2(country))
+ psoc_reg->world_country_pending = true;
+ else
+ psoc_reg->new_user_ctry_pending = true;
if (psoc_reg->offload_enabled) {
tx_ops = reg_get_psoc_tx_ops(psoc);
@@ -1439,8 +1453,25 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
return QDF_STATUS_E_FAULT;
}
} else {
- qdf_mem_copy(rd.cc.alpha, country, REG_ALPHA2_LEN + 1);
- rd.flags = ALPHA_IS_SET;
+ if (reg_is_world_alpha2(country)) {
+ pdev_priv_obj = reg_get_pdev_obj(pdev);
+ if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+ reg_err("reg component pdev priv is NULL");
+ return QDF_STATUS_E_INVAL;
+ }
+ if (reg_is_world_ctry_code(
+ pdev_priv_obj->def_region_domain))
+ rd.cc.regdmn_id =
+ pdev_priv_obj->def_region_domain;
+ else
+ rd.cc.regdmn_id = DEFAULT_WORLD_REGDMN;
+ rd.flags = REGDMN_IS_SET;
+ } else {
+ qdf_mem_copy(rd.cc.alpha, country,
+ REG_ALPHA2_LEN + 1);
+ rd.flags = ALPHA_IS_SET;
+ }
+
reg_program_chan_list(pdev, &rd);
}
@@ -2234,6 +2265,9 @@ static void reg_init_pdev_mas_chan_list(struct wlan_regulatory_pdev_priv_obj
pdev_priv_obj->reg_dmn_pair = mas_chan_params->reg_dmn_pair;
pdev_priv_obj->ctry_code = mas_chan_params->ctry_code;
+ pdev_priv_obj->def_region_domain = mas_chan_params->reg_dmn_pair;
+ pdev_priv_obj->def_country_code = mas_chan_params->ctry_code;
+
qdf_mem_copy(pdev_priv_obj->default_country,
mas_chan_params->default_country, REG_ALPHA2_LEN + 1);
@@ -2757,7 +2791,6 @@ QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info
reg_rule_5g, num_5g_reg_rules,
min_bw_5g, mas_chan_list);
- soc_reg->cc_src = SOURCE_DRIVER;
if (soc_reg->new_user_ctry_pending == true) {
soc_reg->new_user_ctry_pending = false;
soc_reg->cc_src = SOURCE_USERSPACE;
@@ -2768,13 +2801,31 @@ QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info
soc_reg->new_11d_ctry_pending = false;
soc_reg->cc_src = SOURCE_11D;
soc_reg->user_ctry_set = false;
+ } else if (soc_reg->world_country_pending == true) {
+ soc_reg->world_country_pending = false;
+ soc_reg->cc_src = SOURCE_CORE;
+ soc_reg->user_ctry_set = false;
} else {
+ soc_reg->cc_src = SOURCE_DRIVER;
+
+ if (reg_is_world_alpha2(regulat_info->alpha2))
+ soc_reg->cc_src = SOURCE_CORE;
+
qdf_mem_copy(soc_reg->mas_chan_params[phy_id].default_country,
regulat_info->alpha2,
REG_ALPHA2_LEN + 1);
+
+ soc_reg->mas_chan_params[phy_id].def_country_code =
+ regulat_info->ctry_code;
+ soc_reg->mas_chan_params[phy_id].def_region_domain =
+ regulat_info->reg_dmn_pair;
+
qdf_mem_copy(soc_reg->def_country,
regulat_info->alpha2,
REG_ALPHA2_LEN + 1);
+
+ soc_reg->def_country_code = regulat_info->ctry_code;
+ soc_reg->def_region_domain = regulat_info->reg_dmn_pair;
}
pdev = wlan_objmgr_get_pdev_by_id(psoc, phy_id, dbg_id);
diff --git a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h
index b2a0f559a..2f690fee3 100644
--- a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h
+++ b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -822,6 +822,8 @@ enum direction {
* @mas_chan_list: master chan list
* @default_country: default country
* @current_country: current country
+ * @def_region_domain: default reg domain
+ * @def_country_code: default country code
* @reg_dmn_pair: reg domain pair
* @ctry_code: country code
*/
@@ -831,6 +833,8 @@ struct mas_chan_params {
struct regulatory_channel mas_chan_list[NUM_CHANNELS];
char default_country[REG_ALPHA2_LEN + 1];
char current_country[REG_ALPHA2_LEN + 1];
+ uint16_t def_region_domain;
+ uint16_t def_country_code;
uint16_t reg_dmn_pair;
uint16_t ctry_code;
};