From 08fd8610b3c608dd1cdff48b5d0b84e3a75c025e Mon Sep 17 00:00:00 2001 From: "Baila, Shashikala Prabhu" Date: Fri, 5 May 2017 09:03:58 +0530 Subject: [PATCH] qcacmn: Added API to get the current country code API is added to get the current country code from Regdb component. Change-Id: I9c9e7027c9e99f31f72d4a0222d4db1dfa8a7baa CRs-Fixed: 2002892 --- umac/regulatory/core/src/reg_db.c | 6 ++--- umac/regulatory/core/src/reg_db.h | 6 ++--- umac/regulatory/core/src/reg_db_parser.c | 12 ++++----- umac/regulatory/core/src/reg_services.c | 26 ++++++++++++++++++- umac/regulatory/core/src/reg_services.h | 3 +++ .../dispatcher/inc/wlan_reg_ucfg_api.h | 3 +++ .../dispatcher/src/wlan_reg_ucfg_api.c | 6 +++++ 7 files changed, 49 insertions(+), 13 deletions(-) diff --git a/umac/regulatory/core/src/reg_db.c b/umac/regulatory/core/src/reg_db.c index ae05b2853ae7..e0d8a40d3959 100644 --- a/umac/regulatory/core/src/reg_db.c +++ b/umac/regulatory/core/src/reg_db.c @@ -858,21 +858,21 @@ const struct regdomain regdomains_5g[] = { CHAN_5735_5835_5} }, }; -QDF_STATUS get_num_countries(int *num_countries) +QDF_STATUS reg_get_num_countries(int *num_countries) { *num_countries = QDF_ARRAY_SIZE(g_all_countries); return QDF_STATUS_SUCCESS; } -QDF_STATUS get_num_reg_dmn_pairs(int *num_reg_dmn) +QDF_STATUS reg_get_num_reg_dmn_pairs(int *num_reg_dmn) { *num_reg_dmn = QDF_ARRAY_SIZE(g_reg_dmn_pairs); return QDF_STATUS_SUCCESS; } -QDF_STATUS get_default_country(uint16_t *default_country) +QDF_STATUS reg_get_default_country(uint16_t *default_country) { *default_country = CTRY_UNITED_STATES; diff --git a/umac/regulatory/core/src/reg_db.h b/umac/regulatory/core/src/reg_db.h index 9aa6a1a608c1..51844e59eff0 100644 --- a/umac/regulatory/core/src/reg_db.h +++ b/umac/regulatory/core/src/reg_db.h @@ -146,10 +146,10 @@ enum ctl_value { CTL_NONE = 0xff }; -QDF_STATUS get_num_countries(int *num_countries); +QDF_STATUS reg_get_num_countries(int *num_countries); -QDF_STATUS get_num_reg_dmn_pairs(int *num_reg_dmn); +QDF_STATUS reg_get_num_reg_dmn_pairs(int *num_reg_dmn); -QDF_STATUS get_default_country(uint16_t *default_country); +QDF_STATUS reg_get_default_country(uint16_t *default_country); #endif diff --git a/umac/regulatory/core/src/reg_db_parser.c b/umac/regulatory/core/src/reg_db_parser.c index b03c15a17a5e..41142f911022 100644 --- a/umac/regulatory/core/src/reg_db_parser.c +++ b/umac/regulatory/core/src/reg_db_parser.c @@ -32,7 +32,7 @@ QDF_STATUS reg_is_country_code_valid(uint8_t alpha[3]) uint16_t i; int num_countries; - get_num_countries(&num_countries); + reg_get_num_countries(&num_countries); for (i = 0; i < num_countries; i++) { if ((g_all_countries[i].alpha2[0] == alpha[0]) && @@ -95,8 +95,8 @@ QDF_STATUS reg_get_rdpair_from_country_iso(uint8_t *alpha, int num_countries; int num_reg_dmn; - get_num_countries(&num_countries); - get_num_reg_dmn_pairs(&num_reg_dmn); + reg_get_num_countries(&num_countries); + reg_get_num_reg_dmn_pairs(&num_reg_dmn); for (i = 0; i < num_countries; i++) { if ((g_all_countries[i].alpha2[0] == alpha[0]) && @@ -133,7 +133,7 @@ QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t regdmn_id, uint16_t j; int num_reg_dmn; - get_num_reg_dmn_pairs(&num_reg_dmn); + reg_get_num_reg_dmn_pairs(&num_reg_dmn); for (j = 0; j < num_reg_dmn; j++) { if (g_reg_dmn_pairs[j].reg_dmn_pair_id == regdmn_id) @@ -158,8 +158,8 @@ QDF_STATUS reg_get_rdpair_from_country_code(uint16_t cc, int num_countries; int num_reg_dmn; - get_num_countries(&num_countries); - get_num_reg_dmn_pairs(&num_reg_dmn); + reg_get_num_countries(&num_countries); + reg_get_num_reg_dmn_pairs(&num_reg_dmn); for (i = 0; i < num_countries; i++) { if (g_all_countries[i].country_code == cc) diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c index 329711bddf15..8376a957aaf4 100644 --- a/umac/regulatory/core/src/reg_services.c +++ b/umac/regulatory/core/src/reg_services.c @@ -2048,7 +2048,7 @@ QDF_STATUS reg_program_default_cc(struct wlan_objmgr_psoc *psoc, reg_info->psoc = psoc; if (regdmn == 0) { - get_default_country(®dmn); + reg_get_default_country(®dmn); regdmn |= COUNTRY_ERD_FLAG; } @@ -2164,3 +2164,27 @@ QDF_STATUS reg_program_chan_list(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } + +QDF_STATUS reg_get_current_cc(struct wlan_objmgr_psoc *psoc, + struct cc_regdmn_s *rd) +{ + struct wlan_regulatory_psoc_priv_obj *soc_reg; + + soc_reg = (struct wlan_regulatory_psoc_priv_obj *) + wlan_objmgr_psoc_get_comp_private_obj(psoc, + WLAN_UMAC_COMP_REGULATORY); + + if (NULL == soc_reg) { + reg_err("reg soc is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (soc_reg->offload_enabled) + return QDF_STATUS_E_FAILURE; + + if (rd->flags == CC_IS_SET) { + rd->cc.country_code = soc_reg->ctry_code; + } + + return QDF_STATUS_SUCCESS; +} diff --git a/umac/regulatory/core/src/reg_services.h b/umac/regulatory/core/src/reg_services.h index 5ef4100f7441..d5e49fbced2a 100644 --- a/umac/regulatory/core/src/reg_services.h +++ b/umac/regulatory/core/src/reg_services.h @@ -230,4 +230,7 @@ void reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc, QDF_STATUS reg_program_default_cc(struct wlan_objmgr_psoc *psoc, uint16_t regdmn); + +QDF_STATUS reg_get_current_cc(struct wlan_objmgr_psoc *psoc, + struct cc_regdmn_s *rd); #endif diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index 534e3b0f4eb2..f6abfd1db6bc 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -52,6 +52,9 @@ QDF_STATUS ucfg_reg_program_default_cc(struct wlan_objmgr_psoc *psoc, QDF_STATUS ucfg_reg_program_cc(struct wlan_objmgr_psoc *psoc, struct cc_regdmn_s *rd); +QDF_STATUS ucfg_reg_get_current_cc(struct wlan_objmgr_psoc *psoc, + struct cc_regdmn_s *rd); + /** * ucfg_reg_set_config_vars () - Set the config vars in reg component * @psoc: psoc ptr diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index 05aaf3d99ca4..51fa77dcaa2c 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -125,3 +125,9 @@ QDF_STATUS ucfg_reg_program_cc(struct wlan_objmgr_psoc *psoc, { return reg_program_chan_list(psoc, rd); } + +QDF_STATUS ucfg_reg_get_current_cc(struct wlan_objmgr_psoc *psoc, + struct cc_regdmn_s *rd) +{ + return reg_get_current_cc(psoc, rd); +}